Cannot Find Firefox Binary when running Selenium Grid2 on Amazon EC2 - selenium-grid

I've setup my Amazon EC2 instance and I'm able to run my tests and connect successfully, however, I'm unable to run tests for FireFox.
I get the following error...
[remote server] org.openqa.selenium.firefox.internal.Executable(Executable.java):53:in `<init>': Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: LINUX (Selenium::WebDriver::Error::UnknownError)
I've installed XVFB, FireFox, etc.

Solution is to add FireFox location to PATH.

Related

Selenium chromedriver that does not depend on current Chrome installation

Due to organization policy, the Chrome browser installation on my Windows Server machine is automatically updated. I have some processes that rely on python Selenium and chromedriver. Because of this, my process breaks whenever my org decides to push out an update.
Is it possible to have chromedriver depend on some binary other than Chrome browser that will not be managed by my organization so that this doesn't happen?
Few of the workarounds to resolve the issue:
We have kept the chrome exe file in an artifactory and we download and install that particular chrome version every time before our execution through automation (our requirement is like that).
As #Corey is suggesting you can webdrivermanager, PFB link for more details
https://github.com/bonigarcia/webdrivermanager
You can try Dockerized Selenium, there you'll have the control in the docker-compose.yml file.

Browser is not launching even test is running through Jenkins on ubuntu

I am trying to launch browser for automation testing(selenium) using jenkins on ubuntu OS. Test are running properly but browser is not launching seems like it is running headlessly.
I am able to fix this using this solution -
Added Xvfb plugin and added DISPLAY variable.
Running jenkins.war
from console using java -jar jenkins.war
As I know in Windows OS by checking "Allow service to interact with desktop" while jenkins installation we can fix this. So Is there any way we can do this on ubuntu by updating some configuration so we don't have run jenkins.war from console everytime.
There are two ways to facilitate the launch of browser on ubuntu OS.
1.First way - Configure your Jenkins nodes and add the ubuntu machine. Add the sshing details(username-password OR RSA key) of the target machine. This configuration is recommended if you are in cloud.
2.Second way(not recommended on cloud environments) -You have to run a Selenium standalone-Server (a standalone node), and register your remote WebDriver to it.
WebDriver driver = new RemoteWebDriver(new URL("http://ipOfUbuntuMachine:port/wd/hub"), capability);

does geckodriver in selenium comes with firefox or do we need to install it separately?

I am working to deploy my selenium code on remote server. Wondering if Gecko driver in Selenium comes with Firefox or do we need to install it separately on server?
It does not come with firefox. You can download it from here
You can put geckodriver into your project directory and map it to your code so no need to install it on the remote machine.
Please refer below code:
System.setProperty("webdriver.geckodriver.driver",
System.getProperty("user.dir") + "\\ur path\\geckodriver.exe");

How to run the selenium code on linux using firefox without GUI?

I had redhat Linux server command line but there is no GUI for that and I need to run selenium code on this server with firefox. As I am new to selenium so I am not sure whether it will work or not.
For achieving this I had install Firefox on my Redhat linux machine successfully but not able to trigger that as it is showing no display found.
Is there any other way to achieve this for headless browsing, where virtually a firefox will be opened and selenium code can be executed without GUI. Is it possible to do??
You can use HtmlUnitDriver of selenium to use headless browsing but it will not open firefox and may be not loading all content to it's cache as same as firefox
Refer Below:-
https://code.google.com/p/selenium/wiki/HtmlUnitDriver
Another thing you can use is Phantomjs with selenium Webdriver. This is most using pattern by industries for headless browsing
Refer below:-
http://www.guru99.com/selenium-with-htmlunit-driver-phantomjs.html
Yes you can trigger selenium file using command line
http://www.tutorialspoint.com/testng/testng_executing_tests.htm
Bash file is running fine in windows for testng but it is not working in linux/mac
Now if still your firefox is not opening then it is basically issue of some setting with your OS with firefox
Refer that too :-
https://serverfault.com/questions/279036/open-terminal-via-ssh-run-firefox-display-not-found
May be you have problem with some permission in red hat
Hope it will help you :)

[Vagrant][Jenkins][Behat][Selenium] How to combine them?

I have a project with some requirements: install jenkins, selenium, behat on a Vagrant box with ubuntu 12.04. I installed jenkins, selenium, behat on this box. When i run selenium, jenkins and run some behat test, the error display :
- Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: no display specified
Error: no display specified
I installed firefox and use selenium-server-standalone-2.35.0.
firefox -v
Mozilla Firefox 24.0
What should i do?
Thanks
Its most likely that your Jenkins user does not have an X session to run firefox in.
You can use something like Xvfb which is a virtual frame buffer How do I run Selenium in Xvfb?
Alternatively you could use phantomjs/ghostdriver which is a totally headless webdriver for selenium https://github.com/detro/ghostdriver - so you don't need any X at all.
I personally run a selenium hub and connect various drivers to it for different browsers. These drivers can be on different machines and platforms so you can fully test different configurations