当前位置:网站首页>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)
边栏推荐
- Perl转换文件的编码类型
- Jerry's touch key recognition process [chapter]
- Common questions and answering skills of project manager interview
- 左值引用和右值引用
- Jerry's question about long press boot detection [chapter]
- 网上炒股开户安全嘛!?
- Is the project manager a leader? Can you criticize and blame members?
- Openfire solves the problem of Chinese garbled code after using MySQL database
- Solve the problems of Devops landing in complex environment with various tools with full stack and full function solutions
- Summary of operating system interview questions (updated from time to time)
猜你喜欢

Taihu Lake "China's healthy agricultural products · mobile phone live broadcast" enters Taihu Lake

Tensorflow2.4实现RepVGG

为什么一定要从DevOps走向BizDevOps?

Exness: liquidity series - liquidity cleaning and reversal, decision interval

谈谈内联函数
![Jerry's touch key recognition process [chapter]](/img/3e/bb73c735d0a7c7a26989c65a432dad.png)
Jerry's touch key recognition process [chapter]

CADD course learning (1) -- basic knowledge of drug design

Cv+deep learning network architecture pytoch recurrence series basenets (backbones) (I)
Solution to rollback of MySQL database by mistake deletion

The Commission is so high that everyone can participate in the new programmer's partner plan
随机推荐
北京大学ACM Problems 1000:A+B Problem
居家办公没有“血泪史”| 社区征文
CADD course learning (1) -- basic knowledge of drug design
originpro 2021 附安装教程
PM reports work like this, and the boss is willing to give you a raise
Mistakes the project manager should not make
Jerry's touch key recognition process [chapter]
静态类使用@Resource注解注入
Summary of operating system interview questions (updated from time to time)
Exness: the final value of US GDP unexpectedly accelerated to shrink by 1.6%
maya房子建模
【Try to Hack】Windows系统账户安全
All the important spark summit features were released here last night (with ultra clear video attached)
Is the project manager a leader? Can you criticize and blame members?
Heartbeat and DRBD configuration process
【ICCV 2019】特征超分检测:Towards Precise Supervision of Feature Super-Resolution for Small Object Detection
Web host iptables firewall security script
杰理之关于长按复位【篇】
第299场
漏洞扫描工具大全,妈妈再也不用担心我挖不到漏洞了