selenium-rc in bsd - selenium

I'm trying to run selenium-rc in bsd and get the following error
12:45:40.740 WARN - POST /selenium-server/driver/ HTTP/1.1
java.lang.RuntimeException: Firefox couldn't be found in the path!
Please add the directory containing 'firefox-bin' to your PATH environment
variable, or explicitly specify a path to Firefox like this:
*firefox /blah/blah/firefox-bin
Adding firefox-bin to my path does not help.
What is the second option? ("or explicitly specify a path to Firefox like this")
Any solutions?

Trying specifying the path by replacing "*firefox" with "*firefox /path/to/firefox-bin".

In my ubuntu 9.04 setup, I added the '/usr/lib/firefox-3.0.11' to my $PATH

Related

Side Runner argument for 'binary' not working

I am trying to specify the binary path to a specific browser location as described on this website https://www.selenium.dev/selenium-ide/docs/en/introduction/command-line-runner. However the example just does not work. Running the command (with the proper path)
selenium-side-runner -c "goog:chromeOptions.binary='/path/to/non-standard/Chrome/install'"
Generates an error:
TypeError: Target browser must be a string, but is <undefined>; did you forget to call forBrowser()?
Any ideas as to what is going on here?
I had this error too! That section of documentation may be outdated. I resolved the error by using additional params instead.
Here is the format:
selenium-side-runner --broswerName=chrome --chromeOptions="binary='/path/to/non-standard/Chrome/install'"
And here is my example:
selenium-side-runner --broswerName=chrome --chromeOptions="binary='C:\Program Files (x86)\Google\Chrome\Application'" sitegrammarstorevariable.side
I have an Applications folder in my $HOMEdirectory on the Mac and this worked for me:
eval selenium-side-runner -c \"browserName=chrome goog:chromeOptions.binary=\'$HOME/Applications/Google/Google Chrome.app/Contents/MacOS/Google Chrome\'\" *.side
eval is used to generalize the command to any user's home directory.
You have to set both the browser name and the path to the binary this way to make it function properly.

Selenium/Watir can't detect Chromedriver, even though it's in my path (Windows 7)

I know there's another question similar to this, but the link provided by the answerer is out of date (and when I dig into the current Watir documentation I only find info on Windows 8.1; I am on Windows 7, and the step that doc suggests for resolving this is not helping me per below)
I am attempting to execute a test using Watir/minitest (along the lines of rake ci:setup:minitest test TEST=test/full_path/happypath_test.rb), and it chokes on the following:
Selenium::WebDriver::Error::WebDriverError: Unable to find the chromedriver exec
utable. Please download the server from http://chromedriver.storage.googleapis.c
om/index.html and place it somewhere on your PATH. More info at http://code.goog
le.com/p/selenium/wiki/ChromeDriver.
The Watir documentation and error message both point to the PATH. However, I have just downloaded the latest version of Chromedriver (2.12, it appears) and plonked the exe in a folder that I have confirmed is in my PATH (specifically c:/Ruby193/bin - yes I know I'm on an old Ruby version; alas not something I can update for this project)
I know Chromedriver is present because I can run it from irb:
require 'watir-webdriver
followed by
b = Watir::Browser.new :chrome
This launches a chrome window just fine. But when I actually try to execute a test it gives the "can't find chromedriver" error.
I've run bundle install to try and be sure I'm on the right versions of things and don't know what else to do. Any help, please?
Specify the driver_path directly to Selenium.
Simply call this before launching your new browser window:
Selenium::WebDriver::Chrome::Service.driver_path = "/absolute/path/to/chromedriver"
This also has the benefit of not requiring you to muck up your PATH and you can checkthis into your repo (of course, make the path dynamic to your project root directory, etc.).
I found real nice posts here and here. You can configure in super easy steps.
I have tried and tested working superb.
From post 1:
Change from firefox to chrome (wherever you have instantiated the browser ), so that it will become:
#browser = Watir::Browser.new :chrome
Now if you are on Windows, copy paste the downloaded binary file in C:/Windows directory`
Second post tells about how to change the default path c:\windows to your project's custom path. Its interesting and helpful. Take a look for sure.

starting selenium server using custom firefox profile

I have started selenium server using below command and I wanted to use custom firefox profile. But some how it creates a new firefoxprofile in /tmp/ directory for each test case I run.
/usr/bin/java -jar
/usr/local/groundwork/selenium/java/selenium-server-standalone-2.33.0.jar
-firefoxProfileTemplate /root/.mozilla/firefox/lfmvce8i.selenium/ &
When I check firefox process using below command I can see that temporary profile has been created in /tmp directory.
root 35660 4.6 12.9 810852 131352 pts/0 Sl 10:10 0:10
/usr/lib64/firefox/firefox -profile
/tmp/customProfileDirf4461dd4c0fd4b388a595f159568fd4b root 35934
0.0 0.0 103244 840 pts/0 S+ 10:14 0:00 grep firefox
Can someone please help me to use custom firefox profile with selenium.
The option firefoxProfileTemplate is not valid anymore.
Use webdriver.firefox.profile instead.
Your command should be
/usr/bin/java -jar /usr/local/groundwork/selenium/java/selenium-server-standalone-2.33.0.jar -Dwebdriver.firefox.profile=selenium &
See:
http://code.google.com/p/selenium/wiki/FirefoxDriver
Note that -Dwebdriver.firefox.profile takes the NAME of the profile as parameter, not the path.
I am also trying to get the selenium standalone to use a custom firefox profile. By calling the selenium-server from the commandline in a batch file.
I've seen in other posts about custom firefox profile, that the parameter -firefoxProfileTemplate is not valid. If that is the case, why is it listed in the help?
java -jar selenium-server-standalone-2.44.0.jar -h
-firefoxProfileTemplate <dir>: normally, we generate a fresh empty
Firefox profile every time we launch. You can specify a directory
to make us copy your profile directory instead.
I also cant see any difference wether or not I use -firefoxProfileTemplate <path-to-profile> or -Dwebdriver.firefox.profile=<name-of-profile>
java -jar selenium-server-standalone-2.44.0.jar -htmlSuite "*googlechrome" "http://qa-map-pat.valtech.dk" "Test/TESTSUITE.html" "results.html"
Another related issue I'm seing is that I am unable to set the path to the firefox.exe file. I've tried to set it using -Dwebdriver.firefox.bin "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" but it is like this option is just ignored. Instead I had to add the path to my PATH environment variable in Windows.
So it seems to me that the options supplied when calling the selenium server from the commandline are not properly handled?

I am trying to open Jmeter by the batch file but it gives me a Windows error

Here is the related error its showing:
java.exe is not a recognized file as an internal or external command,
operable or external command
errorlevel=9009
i was getting the same error on WIndows 8.1(64 bit) and checked java path but it was ok
so i just run my jmeter.bat with Run as Administrator and it worked for me
Many operating systems have an environment variable such as PATH that contains a list of directories (or folders) to be searched when looking for a command to execute. Commands that can be found via the PATH are commonly called external commands. The program that reads the command line or the batch file and invoked the commands may have a number of built in commands, these are commonly called internal commands.
I suggest you examine the PATH (or equivalent) set when your java command executes from the command line and also when execution is attempted from the batch file. Compare the two and make sure the directory containing your java.exe is in the PATH.
Does not work with Java 9 beta:
Running:
C:\java -version
Gives:
java version "9-ea"
Just go into command line and run:
java -jar ApacheJMeter.jar
Set the correct Java Path (installed in your system) in Computer -> Advanced System settings -> Environment Variables -> Ok -> System Variables -> Path
I got the same issue and resolved by following the above steps.
I tried everything, this eventually worked.
Within System Variables:
PATH = "C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.8.0_101\bin"
May help someone.
This error occurs due to the path has not been set properly.
Either you can set it in environmental varialables or right click jmeter .bat file,choose edit set the path their,for reference see the jmeter.apache.org user manuals.
For me, my Java path has a space in it and jmeter said it can't find Java
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
.. I looked at the jmeter.sh script and saw it got the path from "Plugin-Ins" .. onward. I tried just commenting out the exit command after that check in the script .. and then I was able to run jmeter.
So apparently the validation logic has a bug, where the error message about can't find java is in fact not true (if Java is indeed set up correctly), so it can be ignored.
For windows 8.1 Users:
Error when trying to run jmeter.bat
Error message:
Not able to find Java executable or version. Please check your Java installation. errorlevel=2
Press any Key to continue
Resolution:
Right Click jmeter.bat and Run as Administrator.
This worked for me, hope this helps. Good luck
Set the correct JM_LAUNCH variable to java.exe
For Windows XP users set Java environment by following the steps here:
http://www.tutorialspoint.com/jmeter/jmeter_environment.htm
Note the path depends on your installed JDK.
And download the file from:
https://svn.apache.org/repos/asf/jmeter/trunk/bin/jmeter.bat
Then replace your jmeter.bat with the downloaded file.
If you have installed Java and still you get this error, please set the java_home path to below using typing below command in terminal:
export JAVA_HOME="/Library/InternetPlugIns/JavaAppletPlugin.plugin/Contents/Home"
Since I run many versions of Java.. I modified jmeter.bat.
rem JM_START - set this to "start" to launch JMeter in a separate window
rem this is used by the jmeterw.cmd script.
rem
rem =====================================================
setlocal
rem Minimal version to run JMeter
set MINIMAL_VERSION=1.8.0
set PATH=%PATH%;C:\Program Files (x86)\IBM\Java80\jre\bin <<< add This line to jmeter.bat
Copied the JAVA executable from Installed version of Java from C:\Program FilesJava\jdk1.8.0_191\bin and pasted in the folder where the jmeter bat resides and it worked for me.
Not exactly the same issue but somebody might find it helpful
Do not double click jmeter.bat but instead ApacheJMeter.jar in the same directory
For me jmeter.bat run but for a brief moment closing almost immediately and not prompting any error. Above workaround allowed me to start working
if JAVA -version shows as blank or empty in the command prompt (CMD) then you need to clear the all java paths in environment variable and again add JAVA_HOME=C:\Program Files\Java\jdk-11.0.15.1
path= C:\Program Files\Java\jdk-11.0.15.1\bin;
if you see C:\Program Files\Common Files\Oracle\Java\javapath; like this remove this
and try in new CMD prompt then Java -version will work.

Running selenium tests from Jenkins - cannot find firefox

I have some selenium tests written in java and built using maven. The pom file includes the jbehave and selenium libraries. It uses firefox browser. So I installed firefox on linux and included the path in my .bashrc. If I do a mvn clean install manually , it works fine.
But if I try the same thing using Jenkins ( am trying to automate the tests), it is throwing errors:
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] null
Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: LINUX
Caused by: org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: LINUX
I tried doing an echo of PATH within Jenkins and it did not show the path of firefox. So I also did an export PATH with the new path of firefox included and then called mvn clean install in Jenkins. Even though the PATH now showed the path of firefox in jenkins console output, it still throws the same error.
What is that I am missing?
Three things to check:
1) as #shawnzhu said, check whether you have installed firefox properly?
2) To provide Binary path to your driver, you need to set system property. Use below code for selenium with java:
File firefoxPathBinary = new File("path/to/your//firefox-bin");
System.setProperty("webdriver.firefox.bin", firefoxPathBinary.getAbsolutePath());
driver = new FirefoxDriver();
3) For Ubuntu, path to your firefox executable could be - usr/lib/firefox/firefox-bin and for Mac it could be /Applications/Firefox.app/Contents/MacOS/firefox-bin
You probably need to link the executable:
sudo unlink /usr/bin/firefoxsudo ln -s /path/to/new/firefox/executable /usr/bin/firefox