python爬虫鼠标模拟悬停并点击
#鼠标模拟悬停并点击
import time from selenium import webdriver from selenium.webdriver.firefox.options import Options as FOptions options=FOptions() browser=webdriver.Firefox(executable_path="/Users/mac126/geckodriver",firefox_options=options)
# browser.maximize_window() # browser.get('http://example.webscraping.com') # article=browser.find_element_by_link_text('Log In')#a标签里面的text才能用此函数 # ActionChains(browser).move_to_element(article).perform()#动作链 # menu = browser.find_element_by_xpath('//a[@href="/places/default/user/register?_next=/places/default/index"]') # menu.click()