CentOS Selenium - Preparing firefox profile - firefox

I'm trying use to selenium with firefox on CentOS from command line like this:
java -jar selenium-server-standalone-2.19.0.jar -interactive
Then, I type:
cmd=getNewBrowserSession&1=*firefox&2=http://www.google.com
Then it stucks on "Preparing Firefox profile..." part and crashes:
13:59:13.105 INFO - Preparing Firefox profile... 13:59:33.366 ERROR -
Failed to start new browser session, shutdown browser and clear all
session data
Please help me solve this, I'm quite new to the unix world.
Thanks!

Are you pointing directly to the firefox executable, or are you pointing to an alias?
By default selenium should be pointing to your selenium binary, what is in /usr/bin is usually a script that interacts with the firefox executable.

you could define a specific firefox profile (you have to create it first):
java -jar selenium-server.jar -log SeleniumServer.log -firefoxProfileTemplate "PROFILEPATH" -interactive

And for those wondering, if you're at the command line, you can create a profile like this:
firefox -CreateProfile profilename

Related

Unknown option: -Dwebdriver.chrome.driver when running selenium server standalone on Mac

I was trying to manually run selenium server standalone on MAC and then run my tests with intern-runner in Chrome browser. As I've been advised on intern User Guide:
"To use ChromeDriver and IEDriver with a Selenium server, the driver executable must either be placed somewhere in the environment PATH, or their locations must be given explicitly to the Selenium server using the -Dwebdriver.chrome.driver (ChromeDriver) and -Dwebdriver.ie.driver (IEDriver) flags upon starting the Selenium server."
I started the Selenium server and put path to chrome driver on my machine, but got error:
"Unknown option: -Dwebdriver.chrome.driver"
any idea on why seleinum unable to recognize the options?
Is there any other solution on how to run chrome webdriver/IE webDriver from command line with selenium standalone server?
Where the driver executable could be placed in the environment PATH on MAC?
I was able to run chrome driver separately with out any issues using:
./node_modules/.bin/chromedriver --port=4444 --url-base=wd/hub
For selenium3 you need to use Dwebdriver.chrome.driver option first.
java -Dwebdrive.chrome.driver=path_to_chrome_driver -jar selenium_server_file
To avoid any path issues better download both files in the same directory and run from there.
Example:
java -Dwebdrive.chrome.driver=chromedriver -jar selenium-server-standalone-3.0.1.jar
Also have Chrome browser installed.
Is drive instead of driver

running selenium test suites created by selenium ide (firefox) over command line (ubuntu)

I have the problem that my selenium tests created via the firefox plugin "Selenium IDE" won't work when executed over cli with htmlsuite command. The test should simply open google.de in firefox browser.
I can record and execute the test just fine in selenium ide, but when i execute the following command in cli:
java -jar /var/lib/jenkins/jobs/SuiteCRM_CI_Test/selenium-server-standalone-2.48.2.jar -debug -log /home/jenkins/wtflog.log -firoxProfileTemplate /var/lib/jenkins/jobs/SuiteCRM_CI_Test/firefox_profile -htmlSuite *firefox http://google.de /home/koschig/Arbeitsfläche/seleniumtests/googlesuite.html results.html
All that happens is, firefox will be opened with 2 tabs: one being the firstrun" tab and the other is the following:
chrome://src/content/TestRunner.html?auto=true&multiWindow=true&defaultLogLevel=info&baseUrl=http%3A%2F%2Fgoogle.de&resultsUrl=http://localhost:4444/selenium-server/postResults&test=http%3A%2F%2Flocalhost%3A4444%2Fselenium-server%2Ftests%2Fgooglesuite.html
which gets me an error, file not found
Well, I don't know where the first half of this url comes from, the second half is crafted with the parameters I wrote in the command line.
Does anyone know how to solve this problem? I expected that firefox will be opened and google.de will be accessed...

Running Selenium IDE from batch file ignores user-extensions.js and selblocks. Why?

Hi I would really like to run a testsuite via the Selenium IDE, which I have started up with some custom commands in user-extensions.js and the SelBLocks extensions (for flow control)
with no success.
Is there a command that will start firefox and run the selenium plugin with the suite and baseurl as an argument?
I have had better luck with running the suite with the following command in a batch file (with suitable values for the baseurl, suite & logfile:
java -jar selenium-server-standalone-2.32.0.jar -htmlSuite "*firefox" "%baseurl%" "%suite%" "%log%" -port 4445
But the testrunner will die as soon as it encounters a command defined in user-extensions.js and/or a command from Selblocks.
Can anyone offer some clues to solving either of the above?
The IDE solution would be better (for me) as we do not have a great deal of java or webdriver talent here.
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.
Answering part of my own question here...
add the userExtension parameter to the java command to load the user extensions.
java -jar selenium-server-standalone-2.32.0.jar -userExtensions "path\to\user-extensions.js" -htmlSuite "*firefox" "%baseurl%" "%suite%" "%log%"
Still not sure how to get it to understand the selblocks commands though.

Run selenium scripts in Internet Explorer

I am currently using Selenium RC to run my scripts in FF in windows. Could you tell me how to run the scripts in IE as well?
Your question is not very clear, but assuming you mean you are using the Selenium IDE Firefox plugin to create your tests, you will find this blog post helpful.
You need java installed.
If you're on Windows you probably need to run the command as administrator.
Then run the following command as administrator
java -jar selenium-server-standalone-2.0b3.jar -htmlSuite "*iexplore"
"http://www.google.com" "TestSuite.html"
"results.html" -port 4445
where the parameter "*iexplore" specifies to use InternetExplorer.
Instead of using *firefox or *chrome in your script , use *iexplore or *iexploreproxy

Selenium Grid Demo Test cases fail

I am using selenium grid for automated testing. I have followed the official documents to install the grid. But after running the run-demo-in-parallel, the test casses fail with the following error in the target folder.
Parameter #1 Parameter #2 Parameter #3 Parameter #4
localhost 4444 *firefox http://images.google.com
**Could not contact Selenium Server; have you started it on 'localhost:4444'** ?
Read more at http://seleniumhq.org/projects/remote-control/not-started.html Connection refused: connect
com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:86)
at com.thoughtworks.selenium.grid.tools.ThreadSafeSeleniumSessionStorage.startSeleniumSession(ThreadSafeSeleniumSessionStorage.java:26)at com.thoughtworks.selenium.grid.demo.WebTestForASingleBrowser.domme(WebTestForASingleBrowser.java:51)
Can you please tell me what the issue can be ?
I am using a windows7 machine.
With java jdk and jre 1.6. Selenium version 1.0.8 . Selenium stand alone server -2.5.0.
Is there any more information i can give ?
open up taskmanager and see if there is a process with the name java.exe or javaw.exe running if that is not the case then your Sel Grid has not yet been started. Please open (double click) the selenium-server-standalone-2.5.0.jar file then again statup taskmanager and make sure your grid is up and running and then try.
if the process is nt started It might be the case that your grid is not able to start to some reason I would suggest opening up a command prompt window and run the following command:
java -jar selenium-server-standalone-2.5.0.jar -role hub
Note: You need to be in the directory where the jar file is for the above command to work else cmd will throw an error saying file not found
Please let me know if you need more help.

Resources