TA的每日心情 | 擦汗 2019-7-31 09:14 |
---|
签到天数: 80 天 连续签到: 2 天 [LV.6]测试旅长
|
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.action_chains import ActionChains
import time
binary = FirefoxBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe") #加入Firefox的路径
driver =webdriver.Firefox(firefox_binary=binary)
driver.get("http://www.baidu.com")
above = driver.find_element_by_xpath('//*[@id="u1"]/a[8]')
ActionChains(driver).move_to_element(above).perform()
driver.find_element_by_link_text('搜索设置').click()
**************************************************
执行完这段代码后,Traceback (most recent call last):
File "D:\张艳\test\python\Irhate\windows.py", line 16, in <module>
ActionChains(driver).move_to_element(above).perform()
File "C:\Users\IRH-PC\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\common\action_chains.py", line 77, in perform
self.w3c_actions.perform()
File "C:\Users\IRH-PC\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\common\actions\action_builder.py", line 76, in perform
self.driver.execute(Command.W3C_ACTIONS, enc)
File "C:\Users\IRH-PC\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 249, in execute
self.error_handler.check_response(response)
File "C:\Users\IRH-PC\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 193, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Missing or invalid type argument for pointer action
而且用的别的方法,也找不到搜索设置这个元素,请大神这点迷津!
|
|