Wednesday, August 29, 2012

Steps to run the Selenium Remote Control server


Steps to run the Selenium Remote Control server: 
 
Download: selenium-remote-control server "http://seleniumhq.org/download/"
Extract it to any folder C:,  D: etc.

Run for e.g

java -jar selenium-server.jar -interactive -multiWindow -*chrome -port 4445


Usage: java -jar selenium-server.jar [-interactive] [options]
  • -port <nnnn>: the port number the selenium server should use (default 4444)
  • -timeout <nnnn>: an integer number of seconds before we should give up
  • -interactive: puts you into interactive mode. See the tutorial for more details
  • -multiWindow: puts you into a mode where the test web site executes in a separate window, and selenium supports frames
  • -forcedBrowserMode <browser>: sets the browser mode (e.g. "*iexplore" for all sessions, no matter what is passed to getNewBrowserSession
  • -userExtensions <file>: indicates a JavaScript file that will be loaded into selenium
  • -browserSessionReuse: stops re-initialization and spawning of the browser between tests
  • -avoidProxy: By default, we proxy every browser request; set this flag to make the browser use our proxy only for URLs containing '/selenium-server'
  • -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.
  • -debug: puts you into debug mode, with more trace information and diagnostics
  • -log: writes lots of debug information out to a log file                                                          
  •  Example: java -jar selenium-server.jar -firefoxProfileTemplate /local/profiles/autotests -multiWindow –log /local/selenium.log
  • -htmlSuite <browser> <startURL> <suiteFile> <resultFile>: Run a single HTML Selenese (Selenium Core) suite and then exit immediately, using the specified browser (e.g. "*firefox") on the specified URL (e.g. "http://www.google.com"). You need to specify the absolute path to the HTML test suite as well as the path to the HTML results file we'll generate.
  • -proxyInjectionMode: puts you into proxy injection mode, a mode where the selenium server acts as a proxy server for all content going to the test application. Under this mode, multiple domains can be visited, and the following additional flags are supported:
    • -dontInjectRegex <regex>: an optional regular expression that proxy injection mode can use to know when to bypss injection
    • -userJsInjection <file>: specifies a JavaScript file which will then be injected into all pages
    • -userContentTransformation <regex> <replacement>: a regular expression which is matched against all test HTML content; the second is a string which will replace matches. These flags can be used any number of times. A simple example of how this could be useful: if you add "-userContentTransformation https http" then all "https" strings in the HTML of the test application will be changed to be "http".
We also support two Java system properties: -Dhttp.proxyHost and -Dhttp.proxyPort. Selenium RC normally overrides your proxy server configuration, using the Selenium Server as a proxy. Use these options if you need to use your own proxy together with the Selenium Server proxy. Use the proxy settings like like this:
java -Dhttp.proxyHost=myproxy.com -Dhttp.proxyPort=1234 -jar selenium-server.jar
If your HTTP proxy requires authentication, you will also need to set -Dhttp.proxyUser and -Dhttp.proxyPassword, in addition to http.proxyHost and http.proxyPort.
java -Dhttp.proxyHost=myproxy.com -Dhttp.proxyPort=1234 -Dhttp.proxyUser=joe -Dhttp.proxyPassword=example -jar selenium-server.jar

To stop selenium server – press CTRL+C.


cmd=open&1=http://www.google.com&sessionId=260113
cmd=getNewBrowserSession&1=*chrome&2=http://www.google.com

java -Dhttp.proxyHost=myproxy.com -Dhttp.proxyPort=80 -jar selenium-server.jar -interactive -multiWindow
java -jar selenium-server.jar -interactive -multiWindow

java -jar selenium-server.jar -interactive -multiWindow -forcedBrowserMode *firefox

http://selenium-rc.seleniumhq.org/troubleshooting.html

Proxy issue work around:

cmd=getNewBrowserSession&1=*iehta&2=http://www.google.com
cmd=open&1=http://www.google.com&sessionId=****(change the id to the respective one)

No comments:

Post a Comment