【发布时间】:2015-03-06 02:57:00
【问题描述】:
下面是我的html代码
<td class="MenuEntryName" nowrap="">Business Insurance</td>`
当鼠标悬停在它上面时,td 代码变为
<td class="MenuEntryNameHover" nowrap="">Business Insurance</td>
我已经尝试过使用动作类
WebElement SelectBusinessInsurance1 = driver.findElement(By.xpath("//td[contains(@class, 'MenuEntryName') and text()='Business Insurance']"));
Actions action = new Actions(driver);
WebElement mainMenu = driver.findElement(By.xpath("//td[contains(@class, 'MenuEntryNameHover') and text()='Business Insurance']"));
action.moveToElement(mainMenu).moveToElement(SelectBusinessInsurance1).click().build().perform();
【问题讨论】:
-
您想要完成什么以及问题中提供的代码有哪些错误?
-
实际,没有错误,问题是我无法点击new td
-
你能提供网址或一些例子吗?
-
欢迎来到 Stack Overflow!我编辑了您的问题以正确显示代码。不过,这条线很长——也许你应该引入换行符。