Selenium Chrome driver and Travis CI don't work together











up vote
1
down vote

favorite












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.










share|improve this question
























  • Have a look at stackoverflow.com/questions/38846079/…
    – Balwinder Singh
    Nov 9 at 5:34










  • @BalwinderSingh didn't help. The thing is that I face this issue only when I use Travis but not when I do testing on my local machine
    – THE Waterfall
    Nov 9 at 6:49












  • "Only local connections are allowed" is expected
    – Corey Goldberg
    Nov 9 at 16:01










  • @CoreyGoldberg what's the issue there? Looks like I did everything as supposed to be
    – THE Waterfall
    Nov 9 at 17:58










  • why are you starting a browser in the before_install step?
    – Corey Goldberg
    Nov 9 at 20:05















up vote
1
down vote

favorite












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.










share|improve this question
























  • Have a look at stackoverflow.com/questions/38846079/…
    – Balwinder Singh
    Nov 9 at 5:34










  • @BalwinderSingh didn't help. The thing is that I face this issue only when I use Travis but not when I do testing on my local machine
    – THE Waterfall
    Nov 9 at 6:49












  • "Only local connections are allowed" is expected
    – Corey Goldberg
    Nov 9 at 16:01










  • @CoreyGoldberg what's the issue there? Looks like I did everything as supposed to be
    – THE Waterfall
    Nov 9 at 17:58










  • why are you starting a browser in the before_install step?
    – Corey Goldberg
    Nov 9 at 20:05













up vote
1
down vote

favorite









up vote
1
down vote

favorite











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.










share|improve this question















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.







java spring selenium travis-ci






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 7:41

























asked Nov 9 at 5:21









THE Waterfall

8416




8416












  • Have a look at stackoverflow.com/questions/38846079/…
    – Balwinder Singh
    Nov 9 at 5:34










  • @BalwinderSingh didn't help. The thing is that I face this issue only when I use Travis but not when I do testing on my local machine
    – THE Waterfall
    Nov 9 at 6:49












  • "Only local connections are allowed" is expected
    – Corey Goldberg
    Nov 9 at 16:01










  • @CoreyGoldberg what's the issue there? Looks like I did everything as supposed to be
    – THE Waterfall
    Nov 9 at 17:58










  • why are you starting a browser in the before_install step?
    – Corey Goldberg
    Nov 9 at 20:05


















  • Have a look at stackoverflow.com/questions/38846079/…
    – Balwinder Singh
    Nov 9 at 5:34










  • @BalwinderSingh didn't help. The thing is that I face this issue only when I use Travis but not when I do testing on my local machine
    – THE Waterfall
    Nov 9 at 6:49












  • "Only local connections are allowed" is expected
    – Corey Goldberg
    Nov 9 at 16:01










  • @CoreyGoldberg what's the issue there? Looks like I did everything as supposed to be
    – THE Waterfall
    Nov 9 at 17:58










  • why are you starting a browser in the before_install step?
    – Corey Goldberg
    Nov 9 at 20:05
















Have a look at stackoverflow.com/questions/38846079/…
– Balwinder Singh
Nov 9 at 5:34




Have a look at stackoverflow.com/questions/38846079/…
– Balwinder Singh
Nov 9 at 5:34












@BalwinderSingh didn't help. The thing is that I face this issue only when I use Travis but not when I do testing on my local machine
– THE Waterfall
Nov 9 at 6:49






@BalwinderSingh didn't help. The thing is that I face this issue only when I use Travis but not when I do testing on my local machine
– THE Waterfall
Nov 9 at 6:49














"Only local connections are allowed" is expected
– Corey Goldberg
Nov 9 at 16:01




"Only local connections are allowed" is expected
– Corey Goldberg
Nov 9 at 16:01












@CoreyGoldberg what's the issue there? Looks like I did everything as supposed to be
– THE Waterfall
Nov 9 at 17:58




@CoreyGoldberg what's the issue there? Looks like I did everything as supposed to be
– THE Waterfall
Nov 9 at 17:58












why are you starting a browser in the before_install step?
– Corey Goldberg
Nov 9 at 20:05




why are you starting a browser in the before_install step?
– Corey Goldberg
Nov 9 at 20:05












1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










You are using a chromedriver version that is too old. 2.30 only supports (officially) v58-60. If you're going to use the latest stable (currently 70), as you're installing, you should use a chromedriver that supports it. That would be 2.42 or greater






share|improve this answer





















  • My mistake I didn't mention but I already tried to use the newest chromedriver version. Unfortunately, the result was still the same.
    – THE Waterfall
    Nov 9 at 13:44










  • Why are you starting the chrome browser before running your tests? This will cause issues ` - google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=80 localhost &`
    – Lucas Tierney
    Nov 9 at 13:46












  • What do you mean? But how would I be able to test without a started browser If Selenium requires browser?
    – THE Waterfall
    Nov 9 at 13:51










  • Selenium starts the browser for you, it cannot connect to a browser already running
    – Lucas Tierney
    Nov 9 at 13:52










  • Well, I commented this - google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=80 http://localhost & but the same issue remained
    – THE Waterfall
    Nov 9 at 13:57











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53220276%2fselenium-chrome-driver-and-travis-ci-dont-work-together%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










You are using a chromedriver version that is too old. 2.30 only supports (officially) v58-60. If you're going to use the latest stable (currently 70), as you're installing, you should use a chromedriver that supports it. That would be 2.42 or greater






share|improve this answer





















  • My mistake I didn't mention but I already tried to use the newest chromedriver version. Unfortunately, the result was still the same.
    – THE Waterfall
    Nov 9 at 13:44










  • Why are you starting the chrome browser before running your tests? This will cause issues ` - google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=80 localhost &`
    – Lucas Tierney
    Nov 9 at 13:46












  • What do you mean? But how would I be able to test without a started browser If Selenium requires browser?
    – THE Waterfall
    Nov 9 at 13:51










  • Selenium starts the browser for you, it cannot connect to a browser already running
    – Lucas Tierney
    Nov 9 at 13:52










  • Well, I commented this - google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=80 http://localhost & but the same issue remained
    – THE Waterfall
    Nov 9 at 13:57















up vote
0
down vote



accepted










You are using a chromedriver version that is too old. 2.30 only supports (officially) v58-60. If you're going to use the latest stable (currently 70), as you're installing, you should use a chromedriver that supports it. That would be 2.42 or greater






share|improve this answer





















  • My mistake I didn't mention but I already tried to use the newest chromedriver version. Unfortunately, the result was still the same.
    – THE Waterfall
    Nov 9 at 13:44










  • Why are you starting the chrome browser before running your tests? This will cause issues ` - google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=80 localhost &`
    – Lucas Tierney
    Nov 9 at 13:46












  • What do you mean? But how would I be able to test without a started browser If Selenium requires browser?
    – THE Waterfall
    Nov 9 at 13:51










  • Selenium starts the browser for you, it cannot connect to a browser already running
    – Lucas Tierney
    Nov 9 at 13:52










  • Well, I commented this - google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=80 http://localhost & but the same issue remained
    – THE Waterfall
    Nov 9 at 13:57













up vote
0
down vote



accepted







up vote
0
down vote



accepted






You are using a chromedriver version that is too old. 2.30 only supports (officially) v58-60. If you're going to use the latest stable (currently 70), as you're installing, you should use a chromedriver that supports it. That would be 2.42 or greater






share|improve this answer












You are using a chromedriver version that is too old. 2.30 only supports (officially) v58-60. If you're going to use the latest stable (currently 70), as you're installing, you should use a chromedriver that supports it. That would be 2.42 or greater







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 9 at 13:38









Lucas Tierney

1,52278




1,52278












  • My mistake I didn't mention but I already tried to use the newest chromedriver version. Unfortunately, the result was still the same.
    – THE Waterfall
    Nov 9 at 13:44










  • Why are you starting the chrome browser before running your tests? This will cause issues ` - google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=80 localhost &`
    – Lucas Tierney
    Nov 9 at 13:46












  • What do you mean? But how would I be able to test without a started browser If Selenium requires browser?
    – THE Waterfall
    Nov 9 at 13:51










  • Selenium starts the browser for you, it cannot connect to a browser already running
    – Lucas Tierney
    Nov 9 at 13:52










  • Well, I commented this - google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=80 http://localhost & but the same issue remained
    – THE Waterfall
    Nov 9 at 13:57


















  • My mistake I didn't mention but I already tried to use the newest chromedriver version. Unfortunately, the result was still the same.
    – THE Waterfall
    Nov 9 at 13:44










  • Why are you starting the chrome browser before running your tests? This will cause issues ` - google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=80 localhost &`
    – Lucas Tierney
    Nov 9 at 13:46












  • What do you mean? But how would I be able to test without a started browser If Selenium requires browser?
    – THE Waterfall
    Nov 9 at 13:51










  • Selenium starts the browser for you, it cannot connect to a browser already running
    – Lucas Tierney
    Nov 9 at 13:52










  • Well, I commented this - google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=80 http://localhost & but the same issue remained
    – THE Waterfall
    Nov 9 at 13:57
















My mistake I didn't mention but I already tried to use the newest chromedriver version. Unfortunately, the result was still the same.
– THE Waterfall
Nov 9 at 13:44




My mistake I didn't mention but I already tried to use the newest chromedriver version. Unfortunately, the result was still the same.
– THE Waterfall
Nov 9 at 13:44












Why are you starting the chrome browser before running your tests? This will cause issues ` - google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=80 localhost &`
– Lucas Tierney
Nov 9 at 13:46






Why are you starting the chrome browser before running your tests? This will cause issues ` - google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=80 localhost &`
– Lucas Tierney
Nov 9 at 13:46














What do you mean? But how would I be able to test without a started browser If Selenium requires browser?
– THE Waterfall
Nov 9 at 13:51




What do you mean? But how would I be able to test without a started browser If Selenium requires browser?
– THE Waterfall
Nov 9 at 13:51












Selenium starts the browser for you, it cannot connect to a browser already running
– Lucas Tierney
Nov 9 at 13:52




Selenium starts the browser for you, it cannot connect to a browser already running
– Lucas Tierney
Nov 9 at 13:52












Well, I commented this - google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=80 http://localhost & but the same issue remained
– THE Waterfall
Nov 9 at 13:57




Well, I commented this - google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=80 http://localhost & but the same issue remained
– THE Waterfall
Nov 9 at 13:57


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53220276%2fselenium-chrome-driver-and-travis-ci-dont-work-together%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)