0
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 Answer 1

-1

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

Sign up to request clarification or add additional context in comments.

1 Comment

The problem is that's open another window and i'm trying to click on button for example in the new window but the driver isn't sets on the new windows

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.