Stuck Installing Selenium Server for Python - java

I am trying to use the Selenium standalone server with Python. However, when I type
"C:\Program Files (x86)\Java\jre7\bin\Java.exe" -jar selenium-server-standalone-2.32.0.jar
into the command prompt, the setup gets stuck displaying
May 22, 2013 3:38:18 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
15:38:18.388 INFO - Java: Oracle Corporation 23.21-b01
15:38:18.389 INFO - OS: Windows 7 6.1 x86
15:38:18.394 INFO - v2.32.0, with Core v2.32.0. Built from revision 6c40c18
15:38:18.473 INFO - RemoteWebDriver instances should connect to: http://127.0.0.
1:4444/wd/hub
15:38:18.474 INFO - Version Jetty/5.1.x
15:38:18.475 INFO - Started HttpContext[/selenium-server/driver,/selenium-server
/driver]
15:38:18.475 INFO - Started HttpContext[/selenium-server,/selenium-server]
15:38:18.476 INFO - Started HttpContext[/,/]
15:38:18.498 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#166faa
c
15:38:18.499 INFO - Started HttpContext[/wd,/wd]
15:38:18.501 INFO - Started SocketListener on 0.0.0.0:4444
15:38:18.502 INFO - Started org.openqa.jetty.jetty.Server#144752d
I'm not sure how to get around this problem, any help would be much appreciated.

I don't think you have a problem - that looks to me like the selenium server has started successfully, and is now running. Do you have a problem connecting to it and running a script?

Related

which tomcat service gets started while running a jar from terminal

As i had created a jar from my project, i had started running it from linux terminal using the command
java -jar snapShot.jar
By running this my project works fine and gives console output as
INFO 2018-06-26 13:34:25 [main] -Registering beans for JMX exposure
on startup
INFO 2018-06-26 13:34:25 [main] -Tomcat started on port(s): 8080
(http)
INFO 2018-06-26 13:34:25 [main] -Started DomainApplication in 12.143
seconds (JVM running for 12.662)
I have another Tomcat in my local system. Apache Tomcat Version 8.5.29 .
But while running the jar file in terminal i found another tomcat service is running. Actually which gets started?

How to use Selenium Server to run to playback from Selenium Builder

I am using nightwatch.js and selenium to test my application web, i tried a lot of solution in the net, but always the same errors :
D:\nightwatch\node_modules\nightwatch\lib>java -jar selenium-server-standalone-2
.53.0.jar
18:42:37.363 INFO - Launching a standalone Selenium Server
18:42:37.440 INFO - Java: Oracle Corporation 25.92-b14
18:42:37.441 INFO - OS: Windows 7 6.1 amd64
18:42:37.448 INFO - v2.53.0, with Core v2.53.0. Built from revision 35ae25b
18:42:37.492 INFO - Driver class not found: com.opera.core.systems.OperaDriver
18:42:37.493 INFO - Driver provider com.opera.core.systems.OperaDriver is not re gistered
18:42:37.499 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=,platform=MAC}] does not match the current platform VISTA
18:42:37.500 INFO - Driver class not found: org.openqa.selenium.htmlunit.HtmlUnitDriver
18:42:37.501 INFO - Driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver is not registered
18:42:37.598 INFO - RemoteWebDriver instances should connect to:http://127.0.0.1:4444/wd/hub
18:42:37.599 INFO - Selenium Server is up and running

Is Firefox 32 or 33 expected to work with Selenium RC?

Just wanted to ask why Selenium RC is not able to work with recent Firefox versions?
Here is the code (groovy):
import org.openqa.selenium.server.*;
import com.thoughtworks.selenium.DefaultSelenium
import com.thoughtworks.selenium.Selenium
import com.thoughtworks.selenium.SeleniumException
import com.thoughtworks.selenium.Wait
import java.util.concurrent.TimeUnit
RemoteControlConfiguration rcc = new RemoteControlConfiguration()
System.out.println("Using firefox launcher")
File ffp = new File("C:\\Work\\ff_custom_profile")
rcc.setFirefoxProfileTemplate(ffp)
rcc.setPort(4444)
seleniumServer = new SeleniumServer(rcc)
seleniumServer.start()
System.out.println("Server started")
Selenium seleniumInstance = new DefaultSelenium("localhost", 4444, "firefox", "https://url/")
seleniumInstance.start()
System.out.println("Driver started");
When I run this code with Firefox 28 (Windows 7 x86), it works fine:
Using firefox launcher
20:46:35.692 INFO - Java: Sun Microsystems Inc. 20.14-b01
20:46:35.692 INFO - OS: Windows 7 6.1 x86
20:46:35.723 INFO - v2.43.1, with Core v2.43.1. Built from revision 5163bce
20:46:36.020 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
20:46:36.020 INFO - Version Jetty/5.1.x
20:46:36.020 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
20:46:36.035 INFO - Started HttpContext[/selenium-server,/selenium-server]
20:46:36.035 INFO - Started HttpContext[/,/]
20:46:36.067 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#1114460
20:46:36.067 INFO - Started HttpContext[/wd,/wd]
20:46:36.067 INFO - Started SocketListener on 0.0.0.0:4444
20:46:36.067 INFO - Started org.openqa.jetty.jetty.Server#15e0873
Server started
20:46:36.160 INFO - Checking Resource aliases
20:46:36.191 INFO - Command request: getNewBrowserSession[firefox, https://url/, ] on session null
20:46:36.207 INFO - creating new remote session
20:46:36.238 INFO - Allocated session 640d3bf362ab4840ad7c3f3ac2b5695d for https://url/, launching...
jar:file:/C:/Work/TMP/selenium-server-standalone-2.43.1.jar!/customProfileDirCUSTFFCHROME
20:46:36.925 INFO - Preparing Firefox profile...
20:46:38.127 INFO - Launching Firefox...
20:46:41.537 INFO - Got result: OK,640d3bf362ab4840ad7c3f3ac2b5695d on session 640d3bf362ab4840ad7c3f3ac2b5695d
Driver started
But when I run this code with Firefox 32 or 33 (Windows 7 x86), I gets the following:
Using firefox launcher
20:49:26.467 INFO - Java: Sun Microsystems Inc. 20.14-b01
20:49:26.467 INFO - OS: Windows 7 6.1 x86
20:49:26.467 INFO - v2.43.1, with Core v2.43.1. Built from revision 5163bce
20:49:26.576 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
20:49:26.576 INFO - Version Jetty/5.1.x
20:49:26.591 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
20:49:26.591 INFO - Started HttpContext[/selenium-server,/selenium-server]
20:49:26.591 INFO - Started HttpContext[/,/]
20:49:26.607 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#1114460
20:49:26.607 INFO - Started HttpContext[/wd,/wd]
20:49:26.623 INFO - Started SocketListener on 0.0.0.0:4444
20:49:26.623 INFO - Started org.openqa.jetty.jetty.Server#15e0873
Server started
20:49:26.669 INFO - Checking Resource aliases
20:49:26.669 INFO - Command request: getNewBrowserSession[firefox, https://url/, ] on session null
20:49:26.669 INFO - creating new remote session
20:49:26.685 INFO - Allocated session 740dfe19fd58418db02be166c420516d for https://url/, launching...
jar:file:/C:/Work/TMP/selenium-server-standalone-2.43.1.jar!/customProfileDirCUSTFFCHROME
20:49:27.247 INFO - Preparing Firefox profile...
20:49:28.386 INFO - Launching Firefox...
Please, note the difference in the output: with Firefox 28, Selenium client started successfully ...
20:46:41.537 INFO - Got result: OK,640d3bf362ab4840ad7c3f3ac2b5695d on session 640d3bf362ab4840ad7c3f3ac2b5695d
... while with Firefox 32 or 33 it failed.
I ran some experiments and found out that I can make it work in FF 32 or 33 by changing the following setting in Firefox profile (prefs.js):
user_pref("browser.startup.homepage_override.mstone", "33.1.1");
If I change it to the value that was in my FF 28 profile (16.0.2):
user_pref("browser.startup.homepage_override.mstone", "16.0.2");
then, it works fine. But I don't like this hack for two reasons:
When I open Firefox after this change with the script, it opens the Whatsnew page (https://www.mozilla.org/en-US/firefox/33.1.1/whatsnew/?oldversion=16.0.2) and it is very annoying for automation.
When I open Firefox after this change manually, this setting goes back to its previous value (33.1.1) and the story starts from the beginning.
I tried different Selenium RC version (2.41, 2.42, 2.43) with the same results.
With Firefox 32 & 33 and Selenium RC 2.44, I get the following error: Failed to start new browser session: java.lang.RuntimeException: java.lang.RuntimeException: Firefox could not be found in the path! Please add the directory containing ''firefox.exe'' to your PATH environment.
Well, I changed the code to...
Selenium seleniumInstance = new DefaultSelenium("localhost", 4444, "*firefox C:\Program Files\Mozilla Firefox\firefox.exe", "https://url/"
... and get the same failure as described above for Selenium 2.42 and 2.43.1.
So here is the question: why Firefox 32 or 33 doesn't work with Selenium RC, and how to make it work?
A note: I do realize it makes sense to migrate to Selenium 2 (WebDriver), but for some reasons, I need to support this legacy code at its current state.
Usually selenium will release a newer version of their client shortly after a browser update. Keep an eye on the downloads page.

Selenium standalone server jar file hangs

I'm having an issue running the Selenium standalone server -- it just hangs partway through loading. I've tried several different versions of the standalone server but the same issue arises. From the command line I run...
java -jar selenium-server-standalone-2.25.0.jar
And get back...
Oct 16, 2012 8:29:34 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
20:29:40.190 INFO - Java: Apple Inc. 20.10-b01-428
20:29:40.193 INFO - OS: Mac OS X 10.7.4 x86_64
20:29:40.202 INFO - v2.25.0, with Core v2.25.0. Built from revision 17137
20:29:40.322 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
20:29:40.324 INFO - Version Jetty/5.1.x
20:29:40.324 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
20:29:40.326 INFO - Started HttpContext[/selenium-server,/selenium-server]
20:29:40.326 INFO - Started HttpContext[/,/]
20:29:40.376 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#1f8b81e3
20:29:40.377 INFO - Started HttpContext[/wd,/wd]
20:29:40.382 INFO - Started SocketListener on 0.0.0.0:4444
20:29:40.383 INFO - Started org.openqa.jetty.jetty.Server#4ee1d5ea
If the comment does not help, try changing start command to
java -jar lib/selenium-server-standalone-2.25.0.jar -role hub
(It is command for starting Selenium Grid, so it might be wrong for you, but I dont know what are you trying to achieve)
And as mentioned above, after the command is run
DO NOT CLOSE COMMAND LINE
Open browser and load http://127.0.0.1:4444/
You should see something like this:
You are using grid 2.25.0
Find help on the official selenium wiki : more help here
default monitoring page : console

Selenium seems to work, but then gets a timeout error?

$ java -jar selenium-server-standalone-2.0b3.jar
00:17:03.883 INFO - Java: Sun Microsystems Inc. 19.0-b09
00:17:03.885 INFO - OS: Linux 2.6.32-305-ec2 i386
00:17:03.889 INFO - v2.0 [b3], with Core v2.0 [b3]
00:17:04.501 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
00:17:04.530 INFO - Version Jetty/5.1.x
00:17:04.531 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
00:17:04.532 INFO - Started HttpContext[/selenium-server,/selenium-server]
00:17:04.532 INFO - Started HttpContext[/,/]
00:17:04.614 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#13c5982
00:17:04.614 INFO - Started HttpContext[/wd,/wd]
00:17:04.618 INFO - Started SocketListener on 0.0.0.0:4444
00:17:04.618 INFO - Started org.openqa.jetty.jetty.Server#1ffb8dc
When I run this script:
from selenium.webdriver.common.keys import Keys
import time
browser = webdriver.Remote('http://localhost:4444/wd/hub', {'browser_name':'firefox','platform':'ANY', 'version':'','javascript_enabled':True})
browser.get("http://www.yahoo.com")
The Selenium server seems to work at first:
00:17:08.776 INFO - Executing: [new session: {platform=ANY, browser_name=firefox, javascript_enabled=true, version=}] at URL: /session)
But then I get a python error:
Traceback (most recent call last):
File "fb2.py", line 13, in <module>
browser = webdriver.Remote('http://localhost:4444/wd/hub', {'browser_name':'firefox','platform':'ANY', 'version':'','javascript_enabled':True})
File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 60, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 96, in start_session
'desiredCapabilities': desired_capabilities,
File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 142, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 100, in check_response
raise exception_class(message)
selenium.common.exceptions.WebDriverException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms
Looks like you're using Selenium Grid. The grid consists of a hub and nodes which connect to it. When you run a test you send a request to the server which dispatches it accordingly to a host with the appropriate configuration according to what you defined in desired_capabilities. In this case you don't seem to have started a node anywhere.
You have failed to start a node it seems. Also I believe to use a WebDriver requires Grid 2.0. As I understand it, the build you are using only has Grid support for RC API. You can use the following guide if you download and compile the current trunk:
http://code.google.com/p/selenium/wiki/Grid2

Categories