Python Selenium:使用“onmouseover”将鼠标悬停在“div”上

问题描述

网页浏览

Picture of the webpage showing the menu

网页 HTML 代码段

Webpage HTML

问题

我正在尝试使用 Pyhton 和 Selenium 来抓取这个网站,该网站在鼠标移到“Dossiê”菜单上后会显示子菜单。

尝试

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains

browser = webdriver.Chrome()
action = ActionChains(browser)
(...)
action.move_to_element(browser.find_element_by_id('menuItem1')).perform()

运行此代码时,会引发 NoSuchElementException。已找到该元素,但 move_to_element 调用未显示子菜单。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...