Selenium suites is not running on Chrome and running on FF? - selenium

Case 1:
When using:
C:\Program Files (x86)\Java\jdk1.7.0\bin>java -jar C:\selenium\selenium-2.25.0\selenium-server-standalone-2.25.0.jar -htmlSuite "*googlechrome" https://accounts.google.com/ "C:\selenium\Ide\test_suite.htm" "C:\selenium\Ide\results.htm"
Getting Exception:
HTML suite exception seen: java.lang.RuntimeException:
java.lang.RuntimeException: Google Chrome could not be found in the
path! Please add the directory containing ''chrome.exe' or
'google-chrome' or 'Google Chrome'' to your PATH environment
avariable, or explicitly specify a path to Google Chrome like this:
*googlechrome c:\blah\chrome.exe
Case 2
So Changed
C:\Program Files (x86)\Java\jdk1.7.0\bin>java -jar C:\selenium\selenium-2.25.0\selenium-server-standalone-2.25.0.jar -htmlSuite "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" https://accounts.google.com/ "C:\selenium\Ide\test_suite.htm" "C:\selenium\Ide\results.htm"
Getting:
HTML suite exception seen:
java.lang.RuntimeException: Browser not supported: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
(Did you forget to add a *?)
Supported browsers include:
*firefox
*mock
*firefoxproxy
*pifirefox
*chrome
*iexploreproxy
*iexplore
*firefox3
*safariproxy
*googlechrome
*konqueror
*firefox2
*safari
*piiexplore
*firefoxchrome
*opera
*webdriver
*iehta
*custom
at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.browserNotSupported(BrowserLauncherFactory.java:151)
at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.getBrowserLauncher(BrowserLauncherFactory.java:127)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.getBrowserLauncher(HTMLLauncher.java:78)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:138)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:196)
at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:612)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:286)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:244)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:54)
23:23:19.194 INFO - Shutting down...
Case 3
So Changed again with browser as *chrome
it should run on chrome but it is running on Firefox

use *googlechrome to run on Chrome browser.
And add the directory containing 'chrome.exe' or 'google-chrome' to your PATH environment.
Note - If you just say *chrome it will invoke Firefox Chrome.
It should also work by updating "*googlechrome" argument as -
"*googlechrome C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

Related

Getting error while invoking the chrome browser using selenium

This is the error I am getting while running a selenium program
Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from https://chromedriver.storage.googleapis.com/index.html
at org.openqa.selenium.internal.Require$StateChecker.nonNull(Require.java:280)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:135)
at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:38)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:231)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:437)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:127)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:46)
at Selintroduction.main(Selintroduction.java:17)

How to start selenium standalone server ith IE11 webdriver?

I'm trying this command in order to start selenium standalone server with internet explorer 11:
java -jar selenium-server-standalone-3.141.59.jar -Dwebdriver.ie.driver=C:\Users\MyUser\Downloads\IEDriverServer_x64_3.14.0\IEDriverServer.exe -Dwebdriver.ie="C:\Program Files\internet explorer\iexplore.exe"
where MyUser is my current username.
But I'm getting exception.
Using selenium standalone server version 2.53.1 works fine with the same arguments but it's recommanded to use the same version for IE webdriver and selenium.
Here's the exception I have:
Exception in thread "main" com.beust.jcommander.ParameterException: Was passed main parameter '-Dwebdriver.ie.driver=C:\Users\Xavier\Downloads\IEDriverServer_x64_3.14.0\IEDriverServer.exe' but no main parameter was defined in your arg class
at com.beust.jcommander.JCommander.initMainParameterValue(JCommander.java:936)
at com.beust.jcommander.JCommander.parseValues(JCommander.java:752)
[...]
Does anyone know how to run it ?
Fixed this by moving -jar .... at the end of the command:
java -Dwebdriver.ie.driver=C:\Users\MyUser\Downloads\IEDriverServer_x64_3.14.0\IEDriverServer.exe -Dwebdriver.ie="C:\Program Files\internet explorer\iexplore.exe" -jar selenium-server-standalone-3.141.59.jar

Robot Framework can't find chromedriver in PATH variable

I want to use Chrome for automation test with Robot Framework. Here are my settings:
*User variables:*
name: webdriver.chrome.driver
value: C:\chromedriver_win32\chromedriver.exe
name: PATH
values: ......;C:\chromedriver_win32\chromedriver.exe
My code:
*** Settings ***
Library BuiltIn
Library Selenium2Library
Library SikuliLibrary
Library OperatingSystem
*** Variables ***
${HOST} = VM
${URL} = http://VM.com
${BROWSER} = Chrome
*** Test Cases ***
Begin Web Test
Open Browser ${URL} ${BROWSER}
maximize browser window
After execution of command: pybot test.robot:
==============================================================================
[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: No brows
er is open
Test Case FException
AttributeError: "'Service' object has no attribute 'process'" in <bound method
Service.__del__ of <selenium.webdriver.chrome.service.Service object at 0x000000
0003670278>> ignored
Test Case | FAIL |
Setup failed:
WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Plea
se see https://sites.google.com/a/chromium.org/chromedriver/home
------------------------------------------------------------------------------
What is wrong here?
Thank you
"chromedriver' executable needs to be in PATH" means that the location of chromedriver needs to be in the path. In your case, path needs to be "...;C:\chromedriver_win32". PATH contains folders, not executables.
Download Chromedriver.exe from its official website, extract the .exe file and copy this .exe file in scripts folder of Python installation, e.g. C:\Python36\Scripts
After this, add this scripts path in Environment variable, as below:
and now execute your test case.

Providing path to Firefox/Chrome/IE installation in cygwin

I'm trying to launch Firefox remotely on a windows machine from UNIX box using remotewebdriver.
I've tried by adding Firefox in the PATH as below:
$ echo $PATH
/cygdrive/c/Program Files (x86)/Google/Chrome/Application/:/cygdrive/c/Program Files (x86)/Mozilla Firefox/
But still the browser fails to launch as the geckodriver.exe tries to find Firefox in the windows default path.
Here is the log from selenium hub:
1486475449767 mozprofile::profile INFO Using profile path
C:\cygwin64\tmp\rus
t_mozprofile.Rmyr2i85U1HV
1486475449774 geckodriver::marionette INFO Starting browser
C:\Program Files (x86)\Mozilla Firefox\firefox.exe
I also tried adding below property while launching selenium node:
-Dwebdriver.firefox.bin="/cygdrive/c/Program Files (x86)/Mozilla Firefox/"
However, the exception was thrown:
Caused by: org.openqa.selenium.WebDriverException: 'webdriver.firefox.bin' property set, but unable to locate the requested binary: /cygdrive/c/Program Files (x86)/Mozilla Firefox/.exe
..........
Exception: Could not initialize class org.openqa.selenium.firefox.internal.Executable
Is there a way to provide the path to the firefox installation folder?
EDIT:
After providing parameters:
-Dwebdriver.gecko.driver=geckodriver.exe -Dwebdriver.firefox.bin="firefox/firefox.exe"
The execution gets stuck at:
1486534065121 mozprofile::profile INFO Using profile path C:\cygwin64\tmp\rust_mozprofile.eqdfIaNAGjDu
1486534065135 geckodriver::marionette INFO Starting browser >C:\cygwin64\home\Administrator\firefox\firefox.exe
1486534065198 geckodriver::marionette INFO Connecting to Marionette on localhost:56702
1486534068740 Marionette INFO Listening on port 56702
Try escape characters and specify the .exe file:
-Dwebdriver.firefox.bin="/cygdrive/c/Program Files\ (x86)/Mozilla Firefox/firefox.exe"

Jenkins and Seleniumhq configuration

I'm trying to set up a simple Selenium test in Jenkins. My OS is Debian GNU/Linux 6.0.7 (squeeze), desktop version (64-bit). I uninstalled the supplied browser iceweasel and intalled Firefox with aptitude. The firefox version is "20.0". I also have Google Chrome installed. I can run Firefox by writing "firefox" in a terminal window.
Jenkins is installed with aptitude.
So, I have installed a plugin in Jenkins called Seleniumhq. These are my settings:
I then receive an error in the Jenkins console when I try to build:
Started by user anonymous
Building in workspace /var/lib/jenkins/workspace/selenium2
java -jar /var/lib/jenkins/selenium-server-standalone-2.0b2.jar -trustAllSSLCertificates -htmlSuite *firefox http://site.com /var/lib/jenkins/jobs/Selenium1/suites/suite1.html /var/lib/jenkins/jobs/Selenium1/logs/selenium.html
[selenium2] $ java -jar /var/lib/jenkins/selenium-server-standalone-2.0b2.jar - trustAllSSLCertificates -htmlSuite *firefox http://site.com /var/lib/jenkins/jobs/Selenium1/suites/suite1.html /var/lib/jenkins/jobs/Selenium1/logs/selenium.html
13:32:18.507 INFO - Java: Sun Microsystems Inc. 14.0-b16
13:32:18.508 INFO - OS: Linux 2.6.32-5-amd64 amd64
13:32:18.512 INFO - v2.0 [b2], with Core v2.0 [b2]
13:32:18.604 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
13:32:18.605 INFO - Version Jetty/5.1.x
13:32:18.606 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
13:32:18.606 INFO - Started HttpContext[/selenium-server,/selenium-server]
13:32:18.607 INFO - Started HttpContext[/,/]
13:32:18.616 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#488e32e7
13:32:18.616 INFO - Started HttpContext[/wd,/wd]
13:32:18.621 INFO - Started SocketListener on 0.0.0.0:4444
13:32:18.621 INFO - Started org.openqa.jetty.jetty.Server#5a5e5a50
HTML suite exception seen:
java.lang.RuntimeException: java.lang.RuntimeException: Firefox 3 could not be found in the path!
Please add the directory containing ''firefox-bin' or 'firefox'' to your PATH environment
variable, or explicitly specify a path to Firefox 3 like this:
*firefox3/blah/blah/firefox-bin
at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.createBrowserLauncher(Bro wserLauncherFactory.java:160)
at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.getBrowserLauncher(Browse rLauncherFactory.java:99)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.getBrowserLauncher(HTMLLauncher.java:58)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:114)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:166)
at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:557)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:250)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:210)
Caused by: java.lang.RuntimeException: Firefox 3 could not be found in the path!
Please add the directory containing ''firefox-bin' or 'firefox'' to your PATH environment
variable, or explicitly specify a path to Firefox 3 like this:
*firefox3/blah/blah/firefox-bin
at org.openqa.selenium.browserlaunchers.locators.Firefox2or3Locator.findBrowserLocationOrFail(Firefox2or3Locator.java:26)
at org.openqa.selenium.server.browserlaunchers.BrowserInstallationCache.locateBrowserInstallation(BrowserInstallationCache.java:27)
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.<init>(FirefoxLauncher.java:52)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.createBrowserLauncher(BrowserLauncherFactory.java:153)
... 7 more
Finished: SUCCESS
I also tried to put this in the browser field:
*firefox/usr/bin/firefox
I think firefox is installed there (i ran "locate firefox").
That config renders another error msg:
...
HTML suite exception seen:
java.lang.RuntimeException: Browser not supported: *firefox/usr/bin/firefox
Supported browsers include:
*firefox
*mock
*firefoxproxy
*pifirefox
*chrome
*iexploreproxy
*iexplore
*firefox3
*safariproxy
*googlechrome
*konqueror
*firefox2
*safari
*piiexplore
*firefoxchrome
*opera
*iehta
*custom
....
Does anybody have ideas about how to fix this?
Thanks!
Edit
I changed the browser settings to this:
*firefox /opt/firefox/firefox (with a space between)
Now it seems FIrefox can be found, but I receive another error:
Started by user anonymous
Building in workspace /var/lib/jenkins/workspace/selenium2
java -jar /var/lib/jenkins/selenium-server-standalone-2.0b2.jar -trustAllSSLCertificates -htmlSuite *firefox /opt/firefox/firefox http://site.com /var/lib/jenkins/jobs/selenium2/suites/suite1.html /var/lib/jenkins/jobs/selenium2/logs/selenium.html
[selenium2] $ java -jar /var/lib/jenkins/selenium-server-standalone-2.0b2.jar - trustAllSSLCertificates -htmlSuite "*firefox /opt/firefox/firefox" http://site.com /var/lib/jenkins/jobs/selenium2/suites/suite1.html /var/lib/jenkins/jobs/selenium2/logs/selenium.html
10:51:15.567 INFO - Java: Sun Microsystems Inc. 14.0-b16
10:51:15.569 INFO - OS: Linux 2.6.32-5-amd64 amd64
10:51:15.572 INFO - v2.0 [b2], with Core v2.0 [b2]
10:51:15.668 INFO - RemoteWebDriver instances should connect to: http: //127.0.0.1:4444/wd/hub
10:51:15.669 INFO - Version Jetty/5.1.x
10:51:15.669 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
10:51:15.670 INFO - Started HttpContext[/selenium-server,/selenium-server]
10:51:15.670 INFO - Started HttpContext[/,/]
10:51:15.680 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#3da99561
10:51:15.680 INFO - Started HttpContext[/wd,/wd]
10:51:15.685 INFO - Started SocketListener on 0.0.0.0:4444
10:51:15.685 INFO - Started org.openqa.jetty.jetty.Server#182d9c06
10:51:15.743 INFO - Preparing Firefox profile...
HTML suite exception seen:
java.lang.NullPointerException
at org.openqa.selenium.os.CommandLine.destroy(CommandLine.java:259)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirec tory(FirefoxChromeLauncher.java:117)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:84)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchHTMLSuite(FirefoxChromeLauncher.java:406)
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchHTMLSuite(FirefoxLauncher.java:106)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:121)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:166)
at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:557)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:250)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:210)
10:51:35.789 INFO - Shutting down...
Finished: SUCCESS
Well, I found a good tutorial that turned out to be useful. One important thing is to start a virtual X window on a server where Selenium can start the browser in to run your tests (Xvfb). And in Jenkins the server should be entered just like "*firefox".
http://alex.nederlof.com/blog/2012/11/19/installing-selenium-with-jenkins-on-ubuntu/
You should try to run the commandline from a shell and see what happen. It's certainly a problem linked to the default profile used by the firefox instanciated by selenium.
In my case the problem was that firefox was starting by displaying the tabs that could be restored.
You can also try to create a specific profile :
firefox -p
or
firefox -ProfileManager
then use this dedicated profile using command line parameter :
-firefoxProfileTemplate /home/userXXX/.mozilla/firefox/ljhyckqd.Selenium
java.lang.RuntimeException: Browser not supported: *firefox/usr/bin/firefox
Wrong syntax. try *firefox or *firefox [insert directory]