Selenium RC functionality with java - selenium

I am New to selenium RC..already working on selenium IDE. For selenium RC i have chosen java language.also installed selenium rc server.
Now i dont have any idea have to go further.
Please advice me on same

There are two steps.
You have to start the server with
java -jar selenium-server.jar
And once it is running you can run a java application with something like:
Selenium selenium = new DefaultSelenium( "localhost",
4444,
"*firefox",
"http://www.somesite.com/");
// the code from your Selenium IDE export goes here, e.g.
selenium.open("http://www.somesite.com/somePage.html");
selenium.stop();
For more information see, the following tutorial:
Selenium Remote Control For Java — A Tutorial.

Export the testcases you have in IDE and use them inside your java program.
Sorry to be that generic, but your question is really vague...

Related

Info to update Selenium webdriver

I am using Selenium IDE 2.9.1 at the moment and beginner in Selenium. I invoke the test suite from a .bat file which contains following command:
java -jar C:\Apps\SeleniumTest\selenium-server-standalone-2.52.0.jar -htmlSuite "*firefox" "http://testurl" "C:\Apps\SeleniumTest\SeleniumSuite.html" "C:\Apps\SeleniumTest\SeleniumTestResult.html"
The test suite executes successfully but in TestResult file that is generated following is logged as info:
info: Selenium 1.0 (Core, RC, etc) is no longer under active development. Please update to WebDriver ASAP
I am not planning to use WebDriver, RC. My plan is to stick to Selenium IDE only for basic automation test scripts. Can somebody please tell me what action steps should I take now? I read one similar post but could not find a concrete solution.

Is Selemium IDE deprecated?

From the windows command prompt I run
java -jar selenium-server-standalone-2.50.0.jar -htmlsuite "*firefox"
"http://localhost" "c:\my-test-suite.html"
"c:\my-test-suite-results.html"
The results file shows this message
"info: Selenium 1.0 (Core, RC, etc) is no longer under active development. Please update to WebDriver ASAP"
I am using Selenium IDE to generate the test suite html file.
Can I safely ignore this error message or should I give up on Selenium IDE?
Selenium IDE is not deprecated and you may use it to record\replay scripts.
Actually you may export tests from the Selenium IDE to run with WebDriver (for C#, Java or Ruby).
Selenium WebDriver is enchanced version (I'd say next generation) of the Selenium RC so it's more powerfull and flexible, and it's under active development to support actual browser versions.
Selenium RC is still maintained but not developed so in fact you may safely continue with it as long as it satisfies your needs.

Selenium testing machine

--- TL;DR
At this point I suggest everyone to tied their Continuous Integration server/service to https://ghostinspector.com/
OLD QUESTION
after three days googling and testing I gave up, and I need help.
My objective is allow my co-workers to record one or more tests with Selenium IDE. Export them, upload them into a server, and get this server running these tests using the webdriver with htmlunit. As we build or fix the app, we will upload the tests to make out test library.
Record a test with Selenium IDE is okay. But getting it running is the problem. The machine we intend to let the tests is an linux amazon server. No front-end stuff, no kde, gtk, so no firefox, chrome, etc... This is why I've specified the htmlunit driver.
So far I wasn't able to get this task running even into my machine - Ubuntu 12.04 x86_64.
I downloaded the selenium-server tarball, and tried running:
java -jar selenium-server.jar -htmlSuite "*webdriver" "our.site.org" "/path/to/testsuite1.html" "/path/to/report1.html"
No success. Even changing the "*webdriver" (using other pops-up a browser screen).
I've tried running the server and the standalone server and connecting via browser.
I've tried PHP bindings by facebook.
I've tried PHPUnit and Testing Selenium classes - along with their respectives exported scripts from Selenium Formatters.
I really do not know where I'm slipping. Can anyone give me a safe direction, tutorial, etc, to follow with?
--- EDIT
Okay, my question may be resumed to:
What si the command line that would allow me to run selenese scripts with selenium-server, using the HtmlUnit driver?
Are you using Continuous Integration?
If so, you should consider getting a plugin to have your CI software run the Selenium tests. Works like a charm for me with Jenkins.
Considering your particular setup, you could both have the amazon linux server run the tests with HTMLUnitDriver, and declare other machines (with a GUI and proper browser) as "nodes" to run your test on other browsers.
Link to a tutorial
Have you read this blog post by David Burns (Automated Tester):
http://www.theautomatedtester.co.uk/tutorials/selenium/selenium_rc_setup.htm
He describes the way to run selenese tests using HTMLSuite.
We are going to use the HTMLSuite commands of the Selenium Remote
Control. This allows you run your Selenese Test Suites as is. The
command should look like java -jar selenium-servre.jar -htmlsuite
. Browser
could be : -*firefox
-*chrome
-*iexplore
-*iehta
-*safari
-*custom /path/to/browser
The path to the test suite and the results file should be a full path.
Here is an example command; java -jar selenium-server.jar -htmlsuite
*iexplore http://www.theautomatedtester.co.uk c:\testsuite\testsuite.html c:\testsuite\results.html
I would point out that htmlunit does not seem to be a supported option so I would expect to use -*custom and provide a path to htmlunit.
This is legacy functionality so there is a chance it doesn't work as expected any more. HTMLSuite expects the tests to be in Selenese (HTML table) format, you mention trying with the PHP binding, I would not expect this to work. If you do want to use some PHP bindings I would suggest using Adam Saunter's fork of the facebook bindings, they are the most up to date and best supported.
https://github.com/Element-34/saunter.php
With Selenium WebDriver you can point to start a HtmlUnit in a already started node
In Java you'll do something like this:
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), DesiredCapabilities.HtmlUnit());
To start the node just make sure to set browserName to 'htmlunit'.

Running a Selenium2 IDE test case on the command line

I need to use the Selenium IDE to create tests for projects we are working on, but to then take these tests and run them from the command line.
The situation is that we want our developers to be able to use the IDE to test websites using a central repository of test suites using the Selenium IDE. We also need the same tests (i.e. in the IDE HTML format) to be run by a CI server (Jenkins) on Sauce Labs.
I have found that the export from the IDE isn't great (test cases that worked on the IDE don't work from the command line). I also need to use WebDriver, e.g Selenium2.
This must be possible but I just cannot see how to do it.
Try out Selunit it combines Selenium tests in Selenese HTML format with Continuous Integration. Here is a tutorial how to execute Selenium tests directly from Selenium IDE in Hudson builds and to benefit from its reporting capabilities provided for JUnit, where Selunit transforms Selenium reports to.
Selenium provides a command-line test script runner, but it's well hidden. Check out the -htmlsuite option of selenium-server.jar.
In windows system you have to download selenium-server-standalone-2.32.0.jar and Browser(IE, chrome) driverserver after downlaod you have to open CMD and run command
java -jar selenium-server-standalone-2.0b3.jar -Dwebdriver.ie.driver=.\IEDriverServer32.exe

Trying to run selenium 2 scripts remotely

I have selenium 2 web driver scripts up and running and I now want to tie those into my continuous integration process. I have 2 physical machines set aside for selenium to run on and a VM machine for our build machine that also runs Hudson.
How do I have Hudson start selenium scripts on a remote machine?
This is an answer for the c# bindings, I guess you're using the java bindings but it should almost be the same.
First you should start the selenium server on the remote selenium server using the selenium-server-standalone-2.0b3.jar found here: http://code.google.com/p/selenium/downloads/list
You start it using:
java -jar selenium-server-standalone-2.0b3.jar
In your test you use the RemoteWebDriver like this:
var desiredCapabilities = DesiredCapabilities.Firefox();
var selenium = new RemoteWebDriver(new Uri("http://seleniumserver1:4444/wd/hub"), desiredCapabilities);
That should make sure your testscripts send all webdriver commands to the remote server.
Grid 2.0 should be in selenium 2.0 beta 4 making it easier to use both selenium servers. ( I guess now you could switch server urls by yourself )