'Can’t find element by Xpath, or the selectors

I am making an automated JKLM bomb party bot using selenium.py (prank my friends). When it is given a link to a private JKLM, it will go there, confirm the username, but then get stuck on the “join game” button (I get TimeoutException Error).

    driver = webdriver.Safari()
    driver.get(link)
    element = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "/html/body/div[2]/div[3]/form/div[2]/input")))
    element.submit()
    element1 = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//button[@class='styled joinRound']")))
    element1.click()

I have tried Absolute XPath: /html/body/div[2]/div[3]/div[1]/div[1]/button Relative XPATH: //button[@class='styled joinRound’] And Class Name: styled joinRound Along with Tag Name and CSS selector.

Any help would be greatly appreciated. HTML I am trying to access and click on:

<button class="styled joinRound" data-text="joinGame">Join game</button>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source