Complete the code to get the text of the element with id 'message'.
element = driver.find_element(By.ID, 'message') text = element.[1]
In Selenium with Python, the text property of a WebElement returns the visible text inside the element.
Complete the code to get the text of the first <p> element on the page.
element = driver.find_element(By.TAG_NAME, 'p') text = element.[1]
The text property returns the visible text inside the element, which is what we want here.
Fix the error in the code to correctly get the text of the element with class 'title'.
element = driver.find_element(By.CLASS_NAME, 'title') text = element.[1]()
The text property is accessed without parentheses. Calling it like a method causes an error.
Fill both blanks to get the text of the element with id 'header' and check if it equals 'Welcome'.
element = driver.find_element(By.[1], 'header') assert element.[2] == 'Welcome'
Use By.ID to find by id, and element.text to get the visible text.
Fill all three blanks to get the text of the element with CSS selector '.nav-item.active' and verify it contains 'Home'.
element = driver.find_element(By.[1], '.nav-item.active') text = element.[2] assert 'Home' [3] text
Use By.CSS_SELECTOR to find by CSS selector, element.text to get text, and the in keyword to check substring presence.