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
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
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()
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