-1

I would like to click on this button but my codes do not work.

The last one I tried is this: driver.find_element_by_xpath("/html/body/app/main/app/div/div/e-arsiv/taslaklar/div[2]/div/div/div[2]/uc-quick-filter[@type='3M]").click()

and I get this error:

elenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression /html/body/app/main/app/div/div/e-arsiv/taslaklar/div[2]/div/div/div[2]/uc-quick-filter[@type='3M] because of the following error:
SyntaxError: Failed to execute 'evaluate' on 'Document': The string '/html/body/app/main/app/div/div/e-arsiv/taslaklar/div[2]/div/div/div[2]/uc-quick-filter[@type='3M]' is not a valid XPath expression.

here is the html

Ed Bangga
  • 12,879
  • 4
  • 16
  • 30
zeppelin11
  • 103
  • 2
  • 3
  • 9

3 Answers3

1

you have a missing enclosing single quote on your text.

driver.find_element_by_xpath("/html/body/app/main/app/div/div/e-arsiv/taslaklar/div[2]/div/div/div[2]/uc-quick-filter[@type='3M']").click()
Ed Bangga
  • 12,879
  • 4
  • 16
  • 30
  • unfortunately it gives the error below. I also tried using an implicit wait : selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element ... is not clickable at point (319, 147). Other element would receive the click:
    ...
    – zeppelin11 Oct 22 '19 at 08:42
  • try this `driver.find_element_by_xpath("/html/body/app/main/app/div/div/e-arsiv/taslaklar/div[2]/div/div/div[2]/uc-quick-filter[@type='3M'][1]").click()` – Ed Bangga Oct 22 '19 at 08:45
  • same error :(
    ...
    is apparently blocking us to click on the button. However, I don't see anything on the screen that blocks.
    – zeppelin11 Oct 22 '19 at 09:36
  • execute_script method solved the issue – zeppelin11 Oct 22 '19 at 09:49
0

Absolute xpath is less preferable. Use css like this


driver.find_element_by_css_selector ("uc-quick-filter.ng-untouched.ng-invalid[type='3M']").click()
Community
  • 1
  • 1
john
  • 413
  • 7
  • 16
  • this didn't worked neither :( throwing --> selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"uc-quick-filter.ng-untouched.ng-invalid[type='3M']"} – zeppelin11 Oct 22 '19 at 07:58
0

Try to copy again the xpath using chrome--> F12 -->right click on element -->copy -->xpath