【问题标题】:selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable (Session info: chrome=81.0.4044.138)selenium.common.exceptions.ElementNotInteractableException:消息:元素不可交互(会话信息:chrome=81.0.4044.138)
【发布时间】:2020-08-28 15:05:33
【问题描述】:
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 行,在登录中 element = driver.find_element_by_xpath('// [@id="joinGame"]/button/span[2]').click() 错误2:selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:无法找到元素:{“method”:“xpath”,“selector”:“//* [@id =“joinGame”]/button/span [2]"} (会话信息:chrome=81.0.4044.138)

【问题讨论】:

    标签: python-3.x selenium-webdriver


    【解决方案1】:

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

    【讨论】:

    • 问题是打开了另一个窗口,我试图在新窗口中点击按钮,但新窗口上没有设置驱动程序
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-10
    • 2019-08-09
    • 1970-01-01
    相关资源
    最近更新 更多