我试过这段代码:
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)
答案 0 :(得分:1)
您的导入声明可能有误。检查以确保您要导入 org.openqa.selenium.Point 和不 java.awt.Point 。