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
Wait Support
Selenium Webdriver - Wait Support
ium提供执行明确和灵活等待同步的等待支持。 为此,我们必须使用 class类。
等候支助的syntax如下:
w = WebDriverWait(driver, 5) w.until(EC.presence_of_element_located((By.TAG_NAME, h1 )))
一旦我们创建网络驱动者Wait阶级的标语,我们就可以在网上使用以下方法:
until_not 在收益价值不真实之前,使用给司机的方法作为参数。
让我们等到能够点击链接的正文小组点——在网页上由网络驱动器Wait方法帮助的小组。
在点击监察组的链接时,案文小组@Ttorials Point出现。
Code Implementation
等待支助的法典实施如下:
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import WebDriverWait 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") #identify element l = driver.find_element_by_pnk_text( Team ) l.cpck() #expected condition for exppcit wait w = WebDriverWait(driver, 5) w.until(EC.presence_of_element_located((By.TAG_NAME, h1 ))) s = driver.find_element_by_tag_name( h1 ) #obtain text t = s.text print( Text is: + t) #driver quit driver.quit()
Output
产出显示了这一信息——退出代码0的过程意味着上述雷达法成功执行。 另外,案文(从文字方法中可以看出)——小组@Ttorials Point在圣殿印刷。
Advertisements