问题描述
我正在准备我的项目,以便能够在 Bitbucket + Jenkins 下启动。 我需要使用远程 Selenium 服务器(如 Selenoid)运行 Selenide 解决方案
如果我在 TestBase 类中对配置进行基本设置,例如:
public void beforetest(){
Configuration.remote = "http://localhost:4444/wd/hub";
}
它可以工作,但仅在从 IntelliJ IDEA 运行时才有效,而不是从控制台运行。
如果我运行 Gradle test
,它将在本地启动 - 而不是在网格/selenoid 上。
我尝试将该属性添加到 gradle.properties
文件中,例如:
systemProp.selenide.remote=http://localhost:4444/wd/hub
但这不起作用。
与 build.gradle 文件相同。我尝试了很多选择:
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")
所有这些都不适合我。
gradle clean test -Dselenide.remote=http://localhost:4444/wd/hub
仍然没有按预期工作...... :(
您对什么可能出错有什么想法吗? 什么是正确的解决方案?
解决方法
工作解决方案是:
systemProperty("selenide.remote","http://0.0.0.0:4444/wd/hub")
IntelliJ IDEA 可能存在其他问题。几次重启后+无效/重启选项,这工作正常。