0
votes
Login_Label = driver.find_element_by_xpath('//*[@id="loginRegisterTabs"]/ul/li[1]')
Login_Label.click()
time.sleep(3)

email = driver.find_element_by_xpath('//*[@id="loginForm"]/div[1]/div/input')
email.send_keys('[email protected]')
time.sleep(3)
password = driver.find_element_by_xpath('//*[@id="loginForm"]/div[2]/div/input')
password.send_keys('asdasd21')
time.sleep(3)

Login_Button = driver.find_element_by_xpath('//*[@id="loginForm"]/p/button[1]').click()
time.sleep(3)

start = driver.find_element_by_xpath('//*[@id="joinGame"]/button').click()

time.sleep(15)
handles = driver.window_handles
for handle in handles:
    driver.switch_to.window(handle)
    print(driver.title)
    if driver.title == 'Gladiatus Province 38':
        element = driver.find_element_by_xpath('//*[@id="joinGame"]/button/span[2]').click()
        element=driver.find_element_by_xpath('//[@id="expedition_list"]/div[1]/div[2]/button').click()

error1 : line 39, in login in element = driver.find_element_by_xpath('// [@id="joinGame"]/button/span[2]').click() error2:selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="joinGame"]/button/span[2]"} (Session info: chrome=81.0.4044.138)

1

1 Answers

-1
votes

you are probably trying to locate a xpath that is not on the page. inspect your webpage again and locate the correct element