51Testing软件测试论坛
标题:
python selenium link-text点击报错
[打印本页]
作者:
glf1588
时间:
2015-6-3 14:25
标题:
python selenium link-text点击报错
代码:
#!/usr/bin/env python
#-*-coding=utf-8
import time
from selenium import webdriver
browser=webdriver.Firefox()
browser.get("https://10.101.139.129")
browser.find_element_by_id("userName").send_keys("admin")
browser.find_element_by_id("authenticateFormID_password").send_keys("admin")
browser.find_element_by_class_name("dinl").click()
browser.find_element_by_class_name("top_right_menu").click()
browser.find_element_by_link_text('Teacherview_1').click()
print '[Note:]browser will quit in 10 seconds'
time.sleep(10)
browser.quit()
firebug抓取:
<a href="#" class="yuimenuitemlabel">Teacherview_1</a>
报错信息:
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"link text","selector":"Teacherview_1"}
怎么就报错呢,麻烦帮忙解释下,万分感谢
作者:
joykao
时间:
2015-6-5 13:36
太快了没抓取到对象?加个等待试试?
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2