python+selenium ie下无法定位元素
selenium与iedriverserver的版本都是2.44代码如下:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Ie()
#driver = webdriver.Firefox()
driver.get("http://www.baidu.com")
driver.implicitly_wait(5)
elem = driver.find_element_by_id("kw")
print elem
driver.close()
driver.quit()
IE浏览器能成功启动,但是无法找到kw元素,系统是win8.1,ie11
报错如下:
Traceback (most recent call last):
File "E:/AutoTest/test.py", line 7, in <module>
elem = driver.find_element_by_id("kw")
File "D:\AutoTest\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 206, in find_element_by_id
return self.find_element(by=By.ID, value=id_)
File "D:\AutoTest\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 662, in find_element
{'using': by, 'value': value})['value']
File "D:\AutoTest\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 173, in execute
self.error_handler.check_response(response)
File "D:\AutoTest\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 166, in check_response
raise exception_class(message, screen, stacktrace)
NoSuchElementException: Message: Unable to find element with id == kw
望哪位大侠指点下啊
在火狐下是可以正常运行的 你搞定了么?可以共享下怎么解决么? 我的火狐打开后直接报错了
页:
[1]