Selenium RC got stuck at "Checking resource aliases" - selenium

I am new to selenium, I got a problem when running selenium RC.
Actually, I have recorded one script via selenium IDE and saved it as test.html and I am able to run the script via selenium IDE but when I try to run the script via selenium RC it gets stuck at some point and displays the following message in the console "Checking resource aliases"
command for running the script via command prompt:
java -jar selenium-server.jar -htmlSuite "*firefox" "www.google.com" "test.html" -port 4445
Let me know the exact reason why this happens?

You should save your tests as a Test Suite also.
At the end you will have two HTML files, the Test Suite and the Test Case (or more if you want).
The command java -jar .... to run selenium, with the -htmlSuite parameter, takes an HTML Test Suite, not a Test Case.
I had the same problem and after passing the Test Suite as the parameter worked as charm.

Step-1: Please create a new html file TestSuite.html
<html>
<head>
<title>My Application Test Suite</title>
</head>
<body>
<table>
<tr><td><b>Suite Of Tests</b></td></tr>
<tr><td>Test Example</td></tr>
</table>
</body>
Step-2: Rename OPSTest.html to your file name test.html.
Step-3: Run this command in command line
java -jar selenium-server.jar -htmlSuite "*firefox" "www.google.com" "TestSuite.html" -port 4445

Related

Export test result in html file with selenium

I use selenium to create my test then i export it to PHPUnit file and i use those commands :
java -jar selenium-server.jar to start server RC
and
phpunit test.php to run script
I need now to save the result into an HTML file.
phpunit test.php --testdox-html test.html
And more at PHPUnit Logging

Selenium htmlsuite report is not created

I stored all my test cases with test suite in the following path in my machine.
/home/mrblack/gtest/*
I run the following command in my terminal everything is working fine. But, the report file is still empty. Can any one help me how to get report file?.
java -jar /var/lib/selenium/selenium-server.jar -htmlSuite "*firefox" "http://www.google.com" "/home/mrblack/gtest/gts" "/tmp/result.html"
I used very simple suite file only.
test case: http://justpaste.it/mrbtc_goo
test sutie: http://justpaste.it/mrbts_goo
Finally I got the solution.. I executed the following line from the current directory of selenium-server.jar file. It works for me
java -jar selenium-server.jar -htmlSuite "*firefox" "http://www.google.com" "gts" "result.html"

selenium standalone server log console is blank

My problem is: selenium standalone server log console shows blank
Steps to reproduce the problem:
Install selenium standalone-2.25.0.jar
Have test suites in same folder
Put in command to run the test through console
java -jar <location_of_selenium>/selenium-server-standalone-2.25.0.jar -htmlSuite *firefox <website URL> <location_of_selenium>/Test_suite1/Test_suite1_ts <location_of_selenium>/Test_suite1_results.html
Expected output:
There are errors in my test and it should show in the Selenium log console as well as create a log file in my selenium folder.
Platform and other Details:
Selenium version: 2.25.0
OS: Ubuntu
Browser: FireFox
Browser version: 7
Pls look how this problem I solved:
java -jar selenium-server-standalone-2.25.0.jar -htmlSuite *firefox http://libo.ru/ c:\temp\selenium\juzsay\testSute1.html testresult1.html
where:
website URL = http://libo.ru/
location_of_selenium = C:\temp\selenium\juzsay\testSute1.html (build with Selenium IDE)
location_of_selenium = testresult1.html (file with test result, in selenium-server-standalone folder)
Some remarks:
1) You should run cmd and open folder where your selenium-server-standalone-2.25.0.jar file located in my situation is C:\tools\selenium2.0\
2) for help also user this command -h
Test suite names need to have .html extension in order for the logs to work
side note: for selenium to run all your tests and not just 1, you must add .html to your test case files as well.
SOLUTION: Rename the suite file to Test_suite1_ts.html

Selenium-PHPUnit, Selenium Grid

Before posting this I checked a lot on this site and on google to figured out my problem.
I am testing my web application which is principally coded in PHP using Symfony2 framework.
I am using Selenium to do my functional tests. All I want to do for the moment is to run my functional tests in parallel on my local machine using Selenium Grid. What I do is recording the test on Selenium IDE and export the test case in phpunit format. I tried to use selenium grid but my phpunit tests are still running sequentially.
What I did:
1) java -jar selenium-server-standalone-2.24.1.jar -role hub
2) java -jar selenium-server-standalone-2.24.1.jar -role node -hub http://localhost:4444/grid/register -browser "browserName=firefox,maxInstances=2,maxSession=2"
3) ant
There is in my build.xml a phpunit target:
<target name="phpunit" description="Run unit tests">
<exec executable="phpunit" failonerror="true"/>
</target>
In my phpunit.xml this part of code is present:
<testsuites>
<testsuite name="LoginSuite">
<file suffix="Test.php">../../src/Tests/FunctionalTests/LoginSuite_testLoginTest.php</file>
</testsuite>
</testsuites>
And my LoginSuite_testLoginTest.php looks like this:
<?php
namespace Tests\FunctionalTests;
use Tests\FunctionalTests\SetUpTest;
class LoginSuite_testLoginTest extends SetUpTest
{
public function testLogin()
{
$this->open("/home");
$this->click("link=Login");
$this->type("id=username", "test.user#gmail.com");
$this->type("id=password", "test");
$this->click("id=_submit");
$this->waitForPageToLoad("30000");
}
public function testLogin2()
{
$this->open("/home");
$this->click("link=Login");
$this->type("id=username", "test.user2#gmail.com");
$this->type("id=password", "test");
$this->click("id=_submit");
$this->waitForPageToLoad("30000");
}
}
?>
At the third step when I launch ant command I am getting a jetty error 500 Problem accessing /selenium-server/driver/
If instead of doing:
java -jar selenium-server-standalone-2.24.1.jar -role node -hub http://localhost:4444 /grid/register -browser "browserName=firefox,maxInstances=2,maxSession=2"
I do the same command without -browser informations it launches my tests but not in parallel..., so strange.
I saw that to launch phpunit tests in parallel we have to create our own script to do it. So in this case do I need selenium grid or not?? I am very confused. Thanks for your help.
There is a parallel wrapper for phpunit command line https://github.com/siivonen/parallel-phpunit so you don't need to write it. You need to have Selenium Hub (with some nodes connected to it) running somewhere. Then you run your tests pointing to that location and the Hub will proxy the calls to free nodes.
We use parallel-phpunit and Selenium Grid with four nodes connected to a hub. Our CI runs 30 minutes of Selenium tests in 3 minutes.
There could be different issues. One is, while running pre recorded steps, you should add seleniumProtocol=Selenium in "browser" argument, because by default it will be the webdriver.

I want to run Selenium test case file from command line

I made then saved a test case with the Firefox extension "Selenium IDE".
Now I want to use command line to run this exported html file.
I try to follow this how-do-i-launch-the-selenium-ide-from-the-command-line-with-a-specific-test-case but it doesn't work.
Please help me.
You will need the Selenium RC which you can get from:
http://seleniumhq.org/download/
And Java 1.5 or higher (Download Java here)
1) Install Java
2) Unpack Selenium RC.
3) Open a cmd.exe window and go to the directory containing the Selenium Server (selenium-remote-control-1.0.1\selenium-server-1.0.1)
4) Run the command below:
java -jar selenium-server.jar -htmlSuite "*firefox" "http://10.8.100.106" "C:\mytestsuite\mytestsuite.html" "C:\mytestsuite\results.html"
This should run your test suite in Firefox and write the results to the html file. Obviously you will need to change the "http://10.8.100.106" argument to your own server (this might just be localhost / 127.0.0.1)
It is possible to run individual test cases using Selenese Runner. You can specify a single test case file or a test suite as the unit to run.
We should execute the SeleniumRC in using following command;
java -jar filename.jar
ex:
java -jar program1.jar
the program1 consist of the followings are:
program1.class file
Resource library file such as SeleniumRC Server.jar and Selenium Java client.jar file
This method is applicable for SeleniumRC execution. We can directly create the program1.jar file from eclipse using
File->Export.
Here is an article that explains you step-by-step process of how to run Selenium RC application in Java.
Create a Java Selenium RC test script and executing the script
I have needed to do this before, and used the following:
An Ant Build (complex)
Creating a test runner class(a part of junit framework)class.
Most commonly we would run into build path errors while trying to run from cmd.
If you want to run it from command prompt you may consider writing your selenium test in python.
Make sure you have python installed if you are on windows. Mac will have python by default.
Running test from CMD is quite easy.
Follow below steps
1- Go to home directory and Set class path
Home Directory > set classpath=Home Directory\bin; and press enter
Home Directory > set classpath=Home Directory\lib*; and press enter
2-Home-directory > java org,testng.TestNG testng.xml testng2.xml testng2.xml and hit enter
I have documented all steps here. Hope it will help. Cheers
1) Running from CMD
java -cp "C:\ProjectX\Mortgage\bin;C:\Selenium_latest\selenium2.49.1\*;C:\Selenium_latest\selenium-2.49.1\libs\*" org.testng.TestNG C:\ProjectX\Mortgage\testng.xml
Run above command in C:\ProjectX\Mortgage
2) Create batch file name runner.bat
SET projectLocation=C:\ProjectX\Mortgage
CD %projectLocation%
SET classpath=%projectLocation%\bin;C:\Selenium_latest\selenium-2.49.1\*;C:\Selenium_latest\selenium-2.49.1\libs\*
java org.testng.TestNG %projectLocation%\testng.xml
PAUSE
3) Run the batch file by double clicking on it.
To be able to run in Chrome browser, you can use *chrome option instead of *firefox like below
java -jar selenium-server.jar -htmlSuite "*chrome" "http://localhost" "C:\testsuite\testsuite.html" "C:\testsuite\results.html"
Other browsers list include:
*firefox
*mock
*firefoxproxy
*pifirefox
*chrome
*iexploreproxy
*iexplore
*firefox3
*safariproxy
*googlechrome
*konqueror
*firefox2
*safari
*piiexplore
*firefoxchrome
*opera
*iehta
*custom
on session null