Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to perform a Selenium test via Bamboo?

We are trying to run some Selenium tests using Selenium CI . We are using maven to build the project and using Selenium web driver.

I followed an Blog post in this link as a reference

When I run the maven project locally (without Bamboo) it worked fine. But when I tried to use it using a Bamboo agent in a windows server it gave an error.

org.openqa.selenium.WebDriverException: Failed to connect to binary
FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 
7055; process output follows:
Build info: version: '2.44.0', 
revision: '76d78cf323ce037c5f92db6c1bba601c2ac43ad8', 
time: '2014-10-23 13:11:40' System 
info: host: 'M',
ip:'myIP',
os.name: 'Windows 7', 
os.arch: 'amd64', 
os.version: '6.1', 
java.version: '1.8.0_11' 
Driver info: driver.version: FirefoxDriver

Then I searched the error assuming it was an error cause by a plug in.

Few of them are:

  • setUp method: Failed to connect to binary FirefoxBinary(/usr/bin/firefox) on port 7055; process output follows:
  • Failed to connect to binary FirefoxBinary with Selenium in Maven

But nothing worked.

like image 321
MarterJay Avatar asked Dec 09 '25 05:12

MarterJay


1 Answers

Found an work around for the problem. I am posting that as an answer for anyone who will go through this situation. But I think there must be a better answer for this. Please post if you know a better way.

First (for us) this situation occurs only when we try to do the Selenium tests using Bamboo agent. Therefore if we look closely the agent is started by a service. So the process (Wrapper.exe) is running as it is run by the "SYSTEM". Therefore when the agent tries to run a program (in our case firefox.exe) that program will also started by the "SYSTEM".

But the "SYSTEM" is not the user who s logged in to the PC. So it cannot interact with the Desktop. Therefore this error occurs.

So what we have to do is run the agent process(Wrapper.exe) by my user, therefore when the agent starts another program such as firefox. It will be run as a process started by my user who can interact with the Desktop. When we do that, then the test runs like a charm!

As the work around what we did is this: Stop the service and run wrapper.exe using the "BambooAgent.bat" in "bamboo-agent-home\bin". You can do this by adding a shortcut of the bin file to the startup folder.

like image 67
MarterJay Avatar answered Dec 13 '25 05:12

MarterJay