selenium.common.exceptions.ElementNotInteractableException:消息:元素不可交互(会话信息:chrome = 81.0.4044.138)

时间:2020-05-12 16:53:18

标签: python-3.x selenium-webdriver

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('asdasd21@gmail.com')
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:第39行,登录 元素= driver.find_element_by_xpath('// [@ id =“ joinGame”] / button / span [2]')。click() error2:selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:无法找到元素:{“ method”:“ xpath”,“ selector”:“ // * [@ id =” joinGame“] / button / span [2]“} (会话信息:chrome = 81.0.4044.138)

1 个答案:

答案 0 :(得分:-1)

您可能正在尝试查找不在页面上的xpath。再次检查您的网页并找到正确的元素