Search code examples
javaintellij-ideaintegerautomated-tests

java: Incompatible types: int cannot be converted to java.time.Duration


Unfortunalety I am getting error message "java: Incompatible types: int cannot be converted to java.time.Duration" thrown in my login_page class.

Can anyone help me fixing this problem?

enter image description here

enter image description here

I am trying to execute my pretty simple test automation using page object model and would expect it to work without errors.

Thank you very much in advance!


Solution

  • Pass Duration not int

    The second arg in the WebDriverWait is of type Duration not int. This should fix it

    Duration duration = Duration.ofSeconds(10);
    WebDriverWait wait = new WebDriverWait(utils.driver, duration);
    

    Also, the statics in your utils class have a code smell. You should use Dependency Injection instead of the static methods / members