Selenium Python find element xpath

Viewed 61

I want to find with selenium this element:

<div ext:tree-node-id="Hard_to-find_object" class="x-tree-node-el x-tree-node-leaf ">

Is it possible?

//div[@ext:tree-node-id="Hard_to-find_object"]

doesn't seems to work for me. "Hard_to-find_object" is unique. Any hints? Thank you.

EDIT: I have to find child of this element, so I need to use xpath.

1 Answers

Use the selecector, they are usually easier. If the element has to load first then use the code here:

WebDriverWait(browser, 0.10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, Hard_to-find_object))) browser.find_element_by_css_selector(Hard_to-find_object).click()

Related