IE浏览器windows 8.1的鼠标悬停问题

2024-10-02 00:37:27 发布

您现在位置:Python中文网/ 问答频道 /正文

这是我的密码:

<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的鼠标悬停问题,我有一个鼠标悬停元素,然后它会打开一个下拉列表,我会点击其中一个链接

它在Windows7的所有IE浏览器版本中都可以正常工作,但在Windows8和8.1的IE浏览器版本中却失败了

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]

请告诉我什么问题可能是我做不到的


Tags: ofdividgohometitlesiteaction
1条回答
网友
1楼 · 发布于 2024-10-02 00:37:27

你试过在链接上悬停吗(这是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();

之后你可以点击你想要的按钮

相关问题 更多 >

    热门问题