gpt4 book ai didi

java - IE 浏览器 Windows 8.1 的鼠标悬停问题

转载 作者:行者123 更新时间:2023-11-29 21:54:56 25 4
gpt4 key购买 nike

这是我的代码:

<div id="banner_h1" class="ui-corner-tr">
TestET Department of Transportation
<a id="js_h2_agency_select_link" class="agencyselectlink" href="javascript:void(0);" title="View List of Agencies">
<img height="12" width="12" alt="Black Down Arrow" src="/images/down.gif">
</a>
<div id="js_h2_agency_select_dropdown" class="h2_agency_select_dropdown ui-corner-bottom invisible" style="position: absolute; top: 22px; left: 6px;">
<div class="dropdown_content ui-corner-all">
<a href="/site/home?action=Go&agencyid=TEST&change=changeagency" title="Lettings for Test Department of Transportation">Test Department of Transportation</a>
<a href="/site/home?action=Go&agencyid=LOCALTEST&change=changeagency" title="Lettings for Locality with Test Department of Transportation">Locality with Test Department of Transportation</a>
<a href="/site/home?action=Go&agencyid=TESTET&change=changeagency" title="Lettings for TestET Department of Transportation">TestET Department of Transportation</a>
<a href="/site/home?action=Go&agencyid=TESTCT&change=changeagency" title="Lettings for TestCT Department of Transportation">TestCT Department of Transportation</a>
<a href="/site/home?action=Go&agencyid=TESTMT&change=changeagency" title="Lettings for TestMT Department of Transportation">TestMT Department of Transportation</a>

这是 IE 的鼠标悬停问题,我有一个鼠标悬停在元素上,然后它打开一个下拉列表,我将单击其中一个链接。

它在 Windows 7 的所有 IE 浏览器版本中工作正常,但在使用 IE 浏览器的 Windows 8 和 8.1 中失败。

Error:ElementNotVisibleException: Cannot click on element

(使用javascript使元素可见但失败)

这是鼠标悬停在元素上的 xpath

//div[@id='banner_h1']/a[@id='js_h2_agency_select_link']/img

或者//html/body/div/div/div[2]/a/img(两者都使用)

鼠标悬停后的 Xpath 单击链接

//html/body/div/div/div[2]/div/div/a[3]

请告诉我问题可能是什么,我无法做到这一点。

最佳答案

您尝试将鼠标悬停在链接上吗? (这是 C# 示例)

                //Hover on link.
Actions actions = new Actions(driver);
IWebElement menuHoverLink = driver.FindElement(By.XPath("//div[@id='banner_h1']"));
actions.MoveToElement(menuHoverLink);
actions.Build().Perform();

之后您可以单击所需的按钮。

关于java - IE 浏览器 Windows 8.1 的鼠标悬停问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33251659/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com