AM 使用下面的代码并尝试将鼠标悬停在链接上。代码成功执行,没有任何错误,但我在网页上看不到任何操作。
系统规格: Windows 7;Mozilla 52.0 64 位;硒 3.3.0
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
public class Mouseaction {
public static void main(String[] args) {
System.setenter code hereProperty("webdriver.gecko.driver","E:\\Selenium\\geckodriver\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://www.flipkart.com");
System.out.println(driver.findElement(By.partialLinkText("Electronics")).isDisplayed());
Actions act = new Actions(driver);
act.moveToElement(driver.findElement(By.partialLinkText("Electronics"))).build().perform();
}
}