Karan
Karan

Reputation: 45

How to wait until for "particular text" is present on page without knowing xpath or element id

I want to wait until page is fully loaded or some text on page is visible using selenium chrome webdriver. The problem is I can not see inspect element because It is aws terminal linux session.

Text present on page is - "sudo yum update"

Upvotes: 1

Views: 350

Answers (1)

supputuri
supputuri

Reputation: 14145

Option 1: you can check for the text in the page source.

import re  # make sure to add this package

src = driver.page_source
text_found = re.search(r'sudo yum update', src)
print (text_found)

Option 2:

simply use the xpath to wait for element present.

//*[contains(.,'sudo yum update')]

Upvotes: 2

Related Questions