Java IE浏览器windows 8.1的鼠标悬停问题
这是我的代码:Java IE浏览器windows 8.1的鼠标悬停问题,java,python,mysql,selenium,selenium-webdriver,Java,Python,Mysql,Selenium,Selenium Webdriver,这是我的代码: <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="
<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>
//Hover on link.
Actions actions = new Actions(driver);
IWebElement menuHoverLink = driver.FindElement(By.XPath("//div[@id='banner_h1']"));
actions.MoveToElement(menuHoverLink);
actions.Build().Perform();
或
//html/body/div/div/div[2]/a/img两者都使用
//Hover on link.
Actions actions = new Actions(driver);
IWebElement menuHoverLink = driver.FindElement(By.XPath("//div[@id='banner_h1']"));
actions.MoveToElement(menuHoverLink);
actions.Build().Perform();
鼠标点击链接后的Xpath
//html/body/div/div/div[2]/div/div/a[3]
//Hover on link.
Actions actions = new Actions(driver);
IWebElement menuHoverLink = driver.FindElement(By.XPath("//div[@id='banner_h1']"));
actions.MoveToElement(menuHoverLink);
actions.Build().Perform();
请告诉我问题可能是什么,我无法解决。您尝试将鼠标悬停在链接上?这是一个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();
然后你可以点击你想要的按钮
//Hover on link.
Actions actions = new Actions(driver);
IWebElement menuHoverLink = driver.FindElement(By.XPath("//div[@id='banner_h1']"));
actions.MoveToElement(menuHoverLink);
actions.Build().Perform();