Frank
Frank

Reputation: 56

Locating on of the specific elements

I want to locate one of the specific elements on webpage. How to use find_element_by_partial_link_text to find out one of the following text "xxx" or "yyy"?

Example:

I need to find out one of "selenium" and "webdriver".

Using one command instead of following two:

element = driver.find_element_by_partial_link_text("selenium")

or

element = driver.find_element_by_partial_link_text("webdriver")

https://stackoverflow.com/search?q=webdriver

enter image description here

I try element = driver.find_element_by_partial_link_text(["selenium","webdriver"]), but fail.

Upvotes: 1

Views: 56

Answers (1)

iamsankalp89
iamsankalp89

Reputation: 4749

You can use like this in Google page , it is just a demo

driver = driver.Firefox()
driver.get("https://www.google.co.in/?gws_rd=ssl")
element = driver.find_element_by_partial_link_text("Gmail")

Upvotes: 1

Related Questions