51Testing软件测试论坛
标题:
退出按钮定位不起作用
[打印本页]
作者:
段友给我5
时间:
2019-5-17 14:23
标题:
退出按钮定位不起作用
退出按钮虽然有id class 但是都不能点击到
在学课程
python Selenium深入实战电商平台
http://www.atstudy.com/course/1607
作者:
学掌门网校
时间:
2019-5-17 14:24
界面上存在两个元素,拥有相同的id,都是“LogoutButton”
用find_elements()的方法就可以了
具体代码:
driver = webdriver.Chrome()
driver.implicitly_wait(5)
driver.get("https://trial2.otrs365.cn/otrs/index.pl")
driver.find_element_by_id("User").send_keys("zhu.wangren")
driver.find_element_by_id("Password").send_keys("123456")
driver.find_element_by_id("LoginButton").click()
time.sleep(10)
driver.find_elements_by_css_selector("#LogoutButton")[1].click()
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2