Assert/VerifyElementPresent with Python and WebDriver?

前端 未结 5 2093
野趣味
野趣味 2020-12-31 01:05

I may just be confused by the change from Selenium to WebDriver and their respective documentation. In a section about test design in the documentation there is talk of usin

5条回答
  •  天涯浪人
    2020-12-31 01:28

    Another way is as follows:

    from selenium import webdriver
    driver = webdriver.Firefox()
    driver.get('http://www.testing.com')
    element = driver.find_element_by_xpath('xpath of the element').text
    assert element == 'Sample Text'
    driver.quit()
    

提交回复
热议问题