【发布时间】:2021-10-02 03:02:14
【问题描述】:
我正在尝试自动化 Microsoft 登录页面。但是,当我尝试单击登录按钮时,不会发生错误,但按钮没有被单击。
使用的语言 - Python
下面是我的代码
from selenium import webdriver
driver=webdriver.chrome()
url=https://login.microsoftonline.com/
driver.get(url)
button=driver.find.element_by_xpath('//*[@id="idSIButton9"])
username=driver.find.element_by_id("i0116")
username.clear()
username..sendkeys(zyz@gmail.com)
button.click()
password =driver.find.element_by_id("i0118")
password.clear()
password.sendkeys(zyzass)
try:
button.click()
expect StaleElementReferenceException:
print("loggedin")
预期结果 - 1.登录https://login.microsoftonline.com/ 2.输入用户名 3.点击下一步按钮 4.输入密码 5.点击登录
实际结果 - 1.登录https://login.microsoftonline.com/ 2.输入用户名 3.点击下一步按钮 4.输入密码 5.点击无效
代码运行时没有错误。
【问题讨论】:
-
你能接受你评论的答案吗?
标签: python selenium-webdriver ui-automation