I came across this issue while running Geb tests using Gradle build script on Bamboo CI.
The firefox browser would fail with error:
” org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: cannot open display: 1.0
I followed a lot of forums and blog posts for resolution but none of them worked.
The real problem turn out to be the way we need to pass environment variables using “Inline Script” in Bamboo.
chmod a+x gradlew su - root -c "export DISPLAY=localhost:1.0; ./gradlew firefoxTest"