Dkns
Dkns

Reputation: 85

How to find text with Selenium

Guys I need to know how to find a text with Selenium, this one for example:

Test

I can get the text with the following code:

wait.until(EC.element_to_be_clickable((By.XPATH, '//*[text()="Test"]'))).text

But I need to get a text in the following format:

"Key" "[email protected]"

I need to be able to get the above text, remembering the email and password may be different depending on the case, so I would like to get the full value of the string from the .com of the string, since the email will always have a .com, so in this case , I need to be able to find the .com and after finding me return the full value of the string.

Upvotes: 1

Views: 1190

Answers (1)

pmadhu
pmadhu

Reputation: 3433

Use contains in xpath to find a text that has .com. You can also use ends-with. The xpath would be something like this:

 //*[contains(text(),'.com')]

Or

 //*[ends-with(text(),'.com')]

Upvotes: 1

Related Questions