When Travis builds my application and comes to Selenium tests, it throws the following message in the log:
Only local connections are allowed.
and then tests fail with org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
exception
.travis.yml:
language: java
jdk:
- openjdk8
sudo: required
dist: trusty
addons: # get google-chrome-stable
chrome: stable
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3
install:
- wget -N http://chromedriver.storage.googleapis.com/2.43/chromedriver_linux64.zip -P ~/
- unzip ~/chromedriver_linux64.zip -d ~/
- rm ~/chromedriver_linux64.zip
- sudo mv -f ~/chromedriver /usr/local/share/
- sudo chmod +x /usr/local/share/chromedriver
and then
System.setProperty("webdriver.chrome.driver", "/usr/local/share/chromedriver");
webDriver = new ChromeDriver();
Dependency
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.14.0</version>
</dependency>
I feel like it's something about Travis configuration. My application is web-based(Spring), so It has to be working in order to be tested. What should I do so that Selenium tests with Chrome driver will be able to work on Travis CI?
So far, I've seen many ways of solving the problem but none of them worked. I feel like it's impossible. Why is this that problematic?
Updated.
An attempt, as @LucasTierney told, to remove - google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=80 http://localhost &
didn't do any changes.
Updated
Well, finally it began to work with the same config above. I don't know what happend and why it didn't work earlier.