TA的每日心情 | 郁闷 2017-3-14 14:32 |
---|
签到天数: 7 天 连续签到: 1 天 [LV.3]测试连长
|
掉渣饼 发表于 2016-6-22 09:47
WebDriverWait(login, 10).until(lambda the_driver: the_driver.find_element_by_class_name("clearfix"). ...
#coding=utf-8
import login
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains
login.driver.find_element_by_xpath("/html/body/div[5]/div[2]/div[11]/div").click()
'''text = login.driver.find_element_by_xpath('//*[@id="form1"]/div[3]/ul/li[10]/em').text
print(text)
login.driver.find_element_by_xpath('//*[@id="form1"]/div[3]/ul/li[9]/em').click()'''
WebDriverWait(login, 10).until(lambda the_driver: login.driver.find_element_by_class_name("clearfix").is_displayed())
menu=login.driver.find_element_by_class_name("clearfix").find_element_by_link_text(u"建设银行")
ActionChains(login).double_click(menu).perform()
这是我写的代码,我把您给我的代码放进去了,但是这段代码还是提示menu=login.driver.find_element_by_class_name("clearfix").find_element_by_link_text(u"建设银行")找不元素。
问题:Traceback (most recent call last):
File "C:/Users/dy/PycharmProjects/untitled/Login/addCard.py", line 13, in <module>
menu=login.driver.find_element_by_class_name("clearfix").find_element_by_link_text(u"寤鸿閾惰")
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 160, in find_element_by_link_text
return self.find_element(by=By.LINK_TEXT, value=link_text)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 468, in find_element
{"using": by, "value": value})['value']
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 448, in _execute
return self._parent.execute(command, params)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 196, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 181, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element
ps:login是我写的登录脚本 |
|