Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

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 the talk of using Assert vs Verify such as AssertElementPresent. However, in going through the WebDriver tutorial and beginning to set up tests this does not seem to be available from Python. Am I overlooking something in the documentation, is this not applicable to WebDriver, not applicable to using python, should I use capabilities of python and not assert/verify command from selenium, etc?

1 Answer

0 votes
by (62.9k points)

The webdriver is a library for driving browsers. What you want to use are the *find_element* methods to find elements then assert conditions against them.

For example, this code does an assertion check on the web-element presence:

from selenium import webdriver

browser = webdriver.Firefox()

browser.get('https://www.intellipaat.com')

element = browser.find_element_by_tag_name('h1')

assert element.text == 'Example Domains'

browser.quit()

 

Browse Categories

...