webdriver-鼠标悬浮菜单定位

2020-12-17  本文已影响0人  二十尹

引入ActionChains模块

from selenium.webdriver import ActionChains

先定位到顶级菜单

menu = self.find_element_by_xpath('//*[@id="app"]/div[1]/div[1]/div[1]/div')

再将鼠标移到悬浮菜单上

ActionChains(self.driver).move_to_element(menu).perform()

再定位到相应的元素并点击

driver.find_element_by_xpath(''//*[@id="app"]/div[1]/div[1]/div[1]/div[2]/ul/li[2]'').click()
上一篇 下一篇

猜你喜欢

热点阅读