-1

How can I get an item with a specific attribute using selenium and click on it? In my case one with a title of "Store Type". I've tried XPath and many other ways, but still can't do this.

The following is an example image depicting the problem

page markup

Masklinn
  • 34,759
  • 3
  • 38
  • 57
  • This is not a question – Trect Feb 11 '20 at 13:27
  • What thing is this. – Trect Feb 11 '20 at 13:27
  • Please share the code that you are using – Trect Feb 11 '20 at 13:29
  • Please do not share information as images unless absolutely necessary. See: https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors. – AMC Feb 11 '20 at 20:28
  • _I've tried XPath and many other ways_ We need to see those attempts. – AMC Feb 11 '20 at 20:28
  • Does this answer your question? [Is there a way to find an element by attributes in Python Selenium?](https://stackoverflow.com/questions/28426645/is-there-a-way-to-find-an-element-by-attributes-in-python-selenium) – AMC Feb 11 '20 at 20:30

2 Answers2

0

You can get element by xpath:

//div[@title="Store Type"]

If I'm not mistaken in python is:

driver.find_element_by_xpath('//div[@title="Store Type"]').click()
guren
  • 122
  • 2
  • 9
0

You can click on the element using xpath:

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@title='Store Type']"))).click()

Note: You have to add the following imports :

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
Sameer Arora
  • 4,439
  • 3
  • 10
  • 20