1
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.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

1 Answers1

1

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")
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352