浏览器的X和Y轴

时间:2017-10-20 16:02:01

标签: javascript java selenium selenium-webdriver

我试过这段代码:

WebDriver f1=new FirefoxDriver();
f1.get("http://google.com/");
Point P=f1.manage().window().getPosition();
System.out.println(P);
System.out.println(P.getX());
System.out.println(P.getY());

但我收到了这个错误:

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
    Type mismatch: cannot convert from org.openqa.selenium.Point to java.awt.Point

    at Inbox.XandYaxisofbrowser.main(XandYaxisofbrowser.java:14)

1 个答案:

答案 0 :(得分:1)

您的导入声明可能有误。检查以确保您要导入 org.openqa.selenium.Point java.awt.Point