def wait(xpath):
return WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, xpath)))
def find(xpath):
try:
element = wait(xpath)
except:
driver.quit()
element = driver.find_element(By.XPATH, xpath)
return element
mail = find('//*[@id="identifierId"]')
mail.clear()
mail.send_keys('<the email>')
mail_next = find('//*[@id="identifierNext"]')
mail_next.click()
password = find('//*[@id="password"]/div[1]/div/div[1]/input')
password.clear()
password.send_keys('<the passwwordD>')
password_next = find('//*[@id="passwordNext"]')
password_next.click()
错误是“元素输入类=“ whsOnd zHQkBf” name =“密码” type =“密码”无法滚动到视图中“
答案 0 :(得分:0)
driver.execute_script('arguments[0].scrollIntoView(true);', password)
在单击事件之前添加此行。 希望这会有所帮助!