Search code examples
gradleselenideselenoidselenium-remotedriver

Selenide Remote browser config for Gradle Test


I am preparing my project to be able to start under Bitbucket + Jenkins. I need to run Selenide solution with Remote Selenium Server (like Selenoid)

If I do a basic setup of the Configuration in TestBase Class like:

    public void beforeTest(){    
        Configuration.remote = "http://localhost:4444/wd/hub";     
    }

It is working but only when running from IntelliJ IDEA, not from the console.

If I run Gradle test it is starting locally - not on a grid/selenoid.

I tried to add the property to the gradle.properties file like: systemProp.selenide.remote=http://localhost:4444/wd/hub but this is not working as well.

The same with build.gradle file. I tried many options:

systemProperty("selenide.remote", "http://localhost:4444/wd/hub")
systemProperties['selenide.remote'] = 'http://localhost:4444/wd/hub'
System.setProperty("selenide.remote", "http://localhost:4444/wd/hub")

All of these are not working for me.

I used property added to Gradle from the console:

gradle clean test -Dselenide.remote=http://localhost:4444/wd/hub

Which is still not working as expected... :(

Do you have any ideas about what can be wrong? What should be a proper solution?


Solution

  • the working solution is:

    systemProperty("selenide.remote", "http://0.0.0.0:4444/wd/hub")
    

    There was probably an additional issue with IntelliJ IDEA. After few restarts + Invalidate/Restart option, this is working properly.