【发布时间】: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