Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium - Difference between text_to_be_present_in_element and text_to_be_present_in_element_value

Can you illustrate the difference between text_to_be_present_in_element and text_to_be_present_in_element_value with an example, preferably in python ?

The following link seems to explain how text_to_be_present_in_element works but it's still unclear to me.

http://www.seleniumframework.com/python-basic/waits-and-synchronization/

like image 690
Dhiwakar Ravikumar Avatar asked Jan 13 '19 09:01

Dhiwakar Ravikumar


People also ask

What is implicit and explicit wait in selenium Python?

Selenium Webdriver provides two types of waits - implicit & explicit. An explicit wait makes WebDriver wait for a certain condition to occur before proceeding further with execution. An implicit wait makes WebDriver poll the DOM for a certain amount of time when trying to locate an element.

Which of the following methods makes an expectation for checking an element is visible and enabled?

The ElementToBeClickable method in ExpectedConditions class sets an expectation for checking if an element is visible and enabled so that you can click it.

What does WebDriverWait return Python?

By default, the WebDriverWait API executes the ExpectedCondition every 500 milliseconds until it returns successfully. If the ExpectedCondition matches, then the return value will be a Boolean (TRUE) whereas a non-null value for all other ExpectedCondition types.


1 Answers

text_to_be_present_in_element is text value, to get the value with selenium element.text or Javascript element.textContent or element.innerTEXT

<p>this is text</p>

text_to_be_present_in_element_value is value attribute for element, to get the value with selenium element.get_attribute('value') and with JS element.getAttribute('value')

<input type="text" value="text value">
<input type="button" value="button text value">
like image 193
ewwink Avatar answered Sep 18 '22 04:09

ewwink