0

Here's the Xpath for the button I'd like to click:

//*[@id="interstitial_join_btn"]

but when I run something like:

driver.find_element_by_xpath('//*[@id="interstitial_join_btn"]')

the console spits out:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="interstitial_join_btn"]"} (Session info: chrome=80.0.3987.163)

This is to click the join button for a meeting within the web-version of WebEx.

If I could brute force it with pyautogui like some other stuff in my script I would but I've been scratching my head at this for days now (newbie to selenium/HTML)

Thanks

storaged
  • 1,837
  • 20
  • 34

1 Answers1

1

are you sure that the page is completely loaded before you trying to access the element? Maybe you have to wait a bit. e.g.

from selenium.webdriver.support import expected_conditions as EC

wait = WebDriverWait(driver, 10)
element = wait.until(EC.element_to_be_clickable((By.ID, 'interstitial_join_btn')))

see also Selenium - wait until element is present, visible and interactable and https://selenium-python.readthedocs.io/waits.html

BUT: if your HTML code you have provided is correct, you simply have a typo: interstitial_start_btn vs interstitial_join_btn

INDIVIDUAL-IT
  • 426
  • 3
  • 11
  • Thanks for your quick response! I've simply been using time.sleep to wait for the element but I know that shouldn't be the problem as I am altering other parts of that page already. It might help if I show a part of the HTML tree for the button(ignore that it says interstitial start button, that is only when the class is not open): '' – Aaron Williams Apr 16 '20 at 00:36
  • Sorry this is clearer: `` – Aaron Williams Apr 16 '20 at 00:41
  • so you just trying to click the wrong button? see my updated answer `interstitial_start_btn` vs `interstitial_join_btn` – INDIVIDUAL-IT Apr 16 '20 at 03:29
  • As I explained in my response to your comment the button is labelled interstitial_start_btn only when class is not in session. The id updates when the class is available to join so this is not the issue. – Aaron Williams Apr 17 '20 at 03:12