当前位置:网站首页>Playwright - scroll bar operation
Playwright - scroll bar operation
2022-06-30 20:31:00 【The beauty of minimalism】
Playwright - Scroll bar operation
List of articles
During the operation of the page , More or less, there will always be an operation on the scroll bar , This article mainly introduces the use of automation tools Playwright Two ways to operate .
One 、 Operate the scroll bar through page elements
1.1 The scene that
If the element already appears in the page , Just because the scroll bar doesn't scroll down , So I can't see . stay Chrome Pass through F12 Debug view page elements .** Not that the element doesn't exist at all , Delay loading when scrolling .** This can be used . To achieve the purpose of moving the scroll bar .
1.2 Sample code
# Page scroll bar , Scroll until the element appears
page.locator("//div[contains(@class, 'react-grid-item')][last()]")
.scroll_into_view_if_needed()
# Element description : find class It contains ‘react-grid-item’ Attribute last attribute
Two 、 By invoking the mouse API Operate the scroll bar
2.1 The scene that
If there are two scrollbars in the page , To manipulate the target scroll bar , First, use the current cursor to move to the box where the scroll bar is located (div 、iframe etc. )
2.2 Sample code
# Move the cursor to the box where the scroll bar is located
page.click("div.content-main")
# Scroll the mouse , Parameter gives a larger value , To ensure that it moves directly to the end
page.mouse.wheel(0,10000)
边栏推荐
- 居家办公没有“血泪史”| 社区征文
- 北京大学ACM Problems 1004:Financial Management
- maya房子建模
- Meeting, onemeeting, OK!
- PHP文件上传小结(乱码,移动失败,权限,显示图片)
- Lambda 表达式原理分析学习(2022.06.23)
- NLP skill tree learning route - (I) route overview
- CADD course learning (2) -- target crystal structure information
- Document contains & conditional competition
- 杰理之触摸按键识别流程【篇】
猜你喜欢
Exness: the final value of US GDP unexpectedly accelerated to shrink by 1.6%
NLP 论文领读|文本生成模型退化怎么办?SimCTG 告诉你答案
Why should offline stores do new retail?
杰理之触摸按键识别流程【篇】
Transport layer uses sliding window to realize flow control
Halcon knowledge: check the measurement objects [1]
Big God explains open source buff gain strategy live broadcast
Taihu Lake "China's healthy agricultural products · mobile phone live broadcast" enters Taihu Lake
Summary of operating system interview questions (updated from time to time)
消灭Bug,开发者不可不知的几款Bug探索测试神器。
随机推荐
大神詳解開源 BUFF 增益攻略丨直播
SecureCRTPortable的安装和使用(图文详解)
GeoServer installation
How to pass the PMP Exam quickly?
Big God explains open source buff gain strategy live broadcast
文件包含&条件竞争
杰理之检测灵敏度级别确定【篇】
maya房子建模
exness:流动性系列-流动性清洗和反转、决策区间
Jerry's touch key recognition process [chapter]
Build your own website (20)
Tensorflow2.4实现RepVGG
25:第三章:开发通行证服务:8:【注册/登录】接口:接收并校验“手机号和验证码”参数;(重点需要知道【利用redis来暂存数据,获取数据的】的应用场景)(使用到了【@Valid注解】参数校验)
北京大学ACM Problems 1001:Exponentiation
Halcon knowledge: check the measurement objects [1]
All the important spark summit features were released here last night (with ultra clear video attached)
大神详解开源 BUFF 增益攻略丨直播
Build document editor based on slate
杰理之触摸按键识别流程【篇】
Great God detailed open source Buff gain Introduction 丨 Live