I have a code like this:
driver.manage().window().setPosition(newPosition("4.5,4.5"));
The above code gives me an error in the Eclipse IDE and it says:
The method
newPosition(string)
is undefined for the type WebDriverMethods.
How to fix this?
You are completely doing wrong in your code. The syntax is wrong.
There is no such method called newPosition
in WebDriver
.
Read Java Docs for Selenium WebDriver.Window
setPosition
method takes Point
object as an argument.
Point
constructor takes two arguments x
and y
which are of type int
.
Fix your code to this:
driver.manage().window().setPosition(new Point(5, 5));