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

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 :)

Related

How to configure Jenkins to run Selenium scripts on a Headless browser on Windows

I am trying to setup Jenkins to run my Selenium scripts on a Headless browser on Windows. I just found that xvfb only works for Unix based OS but not on Windows. Can anyone please help in configuring the same ?
I tried searching on Google but couldn't find anything helpful.

Error in running test case using batch file via selenium IDE

I used Selenium IDE firefox plugin to record a test case then i used '.bat' command line to automate testing using the below command,
java -jar C:\Selenium\selenium-server-standalone-2.48.2.jar -htmlSuite "*firefox" "http://16.52.110.123:8080/AntExample/userRegistration.htm" "C:\Selenium\First_Test_Real_Suite.html" "C:\selenium\logs\Result.html"
the test was perfectly working using the .bat script when suddenly today I am facing this error message in firefox when I run the script
Firefox can't find the file at
chrome://src/content/TestRunner.html?auto=true&multiWindow=true&defaultLogLevel=info&baseUrl=http://16.52.110.123:8080/AntExample/userRegistration.htm&resultsUrl=http://localhost:4444/selenium-server/postResults&test=http://localhost:4444/selenium-server/tests/First_Test_Real_Suite.html.
I am all ears to fix this issue
You are getting this issue due to latest Firefox browser update :)
First Download and Install Previous Firefox Browser Version 42.0 (Link
: Click here)
and Try to execute same Selenium Test cases using Bat file. It will work properly. :)
Also after Installing Firefox browser, Don't forgot to set following option
Goto Tools >> Options >> Advanced Tab >> Update Tab >> select "Never
check for updates (not recommended: security risk)" option to disable
auto update.
Running Selenium Test cases using bat file will work properly once new "Selenium Standalone Server" version get released (Current version is 2.48.2 will work for Firefox 42.0)
upgrade/downgrade to FF 42.0 fixed the error. Thnx guys
This is indeed because Firefox 43 doesn't allow you to run unsigned add-ons. If you insist on using the old Selenium RC Runner and want to run the latest Firefox, you can enable add-ons again by allowing for unsigned add-ons:
In Firefox go to about:config
Look for setting xpinstall.signatures.required and toggle it to false
Now any unsigned add-on will run, including the Selenium RC Runner. Use it at your own risk ;-)

Using PhantomJS for Selenium's htmlsuite

Trying to port selenese commands from the Selenium IDE to a cron-usable task, and have gotten as far as getting these to run with Webdriver's HTMLSuite command using a local installation of Firefox. However, we need these to run without opening a visual browser - as we're already using PhantomJS elsewhere in the application this seemed like the logical option rather than going down the XVFB route.
Is this possible? I've tried a variety of commands but keep getting errors of phantomjs not being an accepted browser.

Error using SelBlocks extension with Selenium server

I've been recording/writing Selenium html scripts using the SelBlocks extension. Now we're going to use Selenium server to run the tests in different browsers.
I tried getting the javascript from the SelBlock xpi by extracting it and reference that javascript in my selenium server bat file. When I try to run my bat file with referencing the javascript, i got the error "Line: 777 Error: 'XML' is undefined" when I run it in Internet explorer. This happens as the test script is loaded in TestRunner.
When I try to run it in Firefox, TestRunner hangs just prior to running the script.
i'm using Selenium Server 2.1, Firefox 5 and IE8.
Selblocks is only supported for Selenium IDE. See note about "no language translation" here: Selblocks documentation. Although automated translation would be an interesting area of investigation...
I've tried the same thing (Firefox 4.0, Firefox 7.0, selenium-server-2.0.5.jar, SelBlocks 1.3 installed as a firefox plugin).
Since the -userExtensions way didn't work for me, I installed SelBlocks 1.3 in the firefox profile I use with -firefoxProfileTemplate and -htmlSuite. It looks like selenium server doesn't do anything.
After more than a minute I have:
so even the selenium elapsed timer doesn't tick, and no line gets executed.
My simple test case is here.
Looks like I can't use SelBlocks with selenium-server[version].jar for now?
ANNOUNCEMENT: SelBlocks 2.1 now includes support for Selenium Server. Get the extension file here: https://raw.githubusercontent.com/refactoror/SelBlocks/master/user-extensions.js
Initial browser support is for firefox, googlechrome, and opera.

Selenium RC does not open firefox on Ubuntu

When I use the Selenium RC 1.0.3 on windows everything works fine.
When I config the client to use selenium on Ubuntu 10.10 what happens is that the RemoteRunner is opening and showing Command History as if everything works fine, But the other window of firefox does not open hence the test does not run.
I"m pretty sure I misconfiged something on the server, But what is it?
Thanks.
You need to check what happens in RC's command line. If it opens firefox window, but doesnt navigate further - then you need to set firefox to use proxy with the same address and port as your RC. And if it doesn't open at all, then it probably doesn't know where firefox is located, so you need to pass path along with browser definition. This is done either in test case file, or if you use selenium grid, in grid_configuration.yml
*firefox /usr/lib/firefox-5.0/firefox.sh
upd. some say that shell scripts are not good with selenium