Reputation:
image = driver.find_elements_by_xpath("//img[contains(@class,'ui_qtext')]")
copy = driver.find_elements_by_xpath("//p[contains(@class,'ui_qtext')]")
I have this two elements with different tag_names. How do i locate them without the tag_name? Or how do i "combine" this two? Both have the same class_name.
Upvotes: 1
Views: 97
Reputation: 193078
To remove the dependency on the tagNames you can use either of the following Locator Strategies:
Using xpath
:
image_copy = driver.find_elements_by_xpath("//*[contains(@class,'ui_qtext')]")
Using css_selector
:
image_copy = driver.find_elements_by_css_selector(".ui_qtext")
Upvotes: 0