javaeclipseselenium-webdriver

Selenium: newPosition(String) is undefined. How to fix it?


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?


Solution

  • 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

    Fix your code to this:

    driver.manage().window().setPosition(new Point(5, 5));