Selenium Webdriver Tutorial
Selected Reading
- Selenium WebDriver - Discussion
- Selenium WebDriver - Useful Resources
- Selenium WebDriver - Quick Guide
- Double Click
- Right Click
- Capture Screenshots
- Scroll Operations
- Chrome WebDriver Options
- JavaScript Executor
- Select Support
- Wait Support
- Headless Execution
- Executing Tests in Multiple Browsers
- Handling Checkboxes
- Read/Write data from Excel
- Generating HTML Test Reports in Python
- Color Support
- Handling Edit Boxes
- Handling Links
- Alerts
- Windows
- Drag and Drop
- Forms
- Create a Basic Test
- Action Class
- Exceptions
- Cookies
- Backward and Forward Navigation
- Pop-ups
- Explicit and Implicit Wait
- Identify Multiple Elements
- Identify Single Element
- Browser Navigation
- Installation
- Introduction
- Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
JavaScript Executor
Selenium Webdriver - JavaScript Executor
ium可以在执行——文字方法的帮助下执行贾瓦文。 将要执行的指挥作为这种方法的参数。 我们可以开展浏览器行动,如在贾瓦·古斯塔尔检察官的帮助下点击链接。
The syntax for implementing the Javascript directation:
b = driver.find_element_by_id("txt") driver.execute_script ("arguments[0].cpck();",b)
Code Implementation
执行 Java指令的守则如下:
from selenium import webdriver driver = webdriver.Chrome(executable_path= ../drivers/chromedriver ) #imppcit wait time driver.imppcitly_wait(5) #url launch driver.get("https://www.tutorialspoint.com/about/about_careers.htm") #cpck with JavaScript Executor b = driver.find_element_by_pnk_text("Cookies Popcy") driver.execute_script ("arguments[0].cpck();",b) print( Page title after cpck: + driver.title) #driver quit driver.quit()
Output
产出显示了这一信息——退出代码0的过程意味着上述雷达法成功执行。 另外,在被点击后申请的页标题(从司机处获得)。 标题方法——图兰斯点的库克群岛政策——图利斯点的印本。
execute_script
ium不能直接处理发生功能。 谷物可以在该方法的帮助下执行 Java式的指令——执行。 即将执行的贾瓦底指挥作为这一方法的一个参数。
syntax,用于在执行任务时使用手稿方法,具体如下:
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
2. 方法编码 用于向浏览器窗户的一个地点倾斜。 薪金是一种要素的财产。 The document. person.scroll 浏览量产生网页的高度。
Code Implementation
在协助执行——文字方法的情况下执行 Java指令的守则如下:
from selenium import webdriver driver = webdriver.Chrome(executable_path= ../drivers/chromedriver ) #imppcit wait time driver.imppcitly_wait(5) #url launch driver.get("https://www.tutorialspoint.com/index.htm") #scroll to page bottom driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
Output
产出显示,该网页上下页。
Advertisements