- styagi_testing
- Posts : 7
Join date : 2010-05-06
Selenium RC code not running
Thu May 06, 2010 3:54 pm
Hi All,
I'm very new to Selenium and stuck up with RC.
1. I'd started RC server and added RC client and JUnit to libraries
2. Recorded a script in IDE and the Java(Junit) code is as follows -
import com.thoughtworks.selenium.*;
public class Test2 extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://localhost:6080/", "*chrome");
}
public void test2() throws Exception {
selenium.open("/ui/");
selenium.type("loginUserId", "admin");
selenium.type("loginPassword", "Secret1");
selenium.click("N10063");
selenium.waitForPageToLoad("30000");
selenium.click("link=Fruit Enterprise");
selenium.waitForPageToLoad("30000");
selenium.click("//img[contains(@src,'http://localhost:6080/ui/default/00000000-000000/partycfg/navMessagingProfilesP.gif')]");
selenium.waitForPageToLoad("30000");
selenium.click("//input[@name='toggleMessagingProfile' and @value='2202']");
selenium.click("N103DB");
selenium.waitForPageToLoad("30000");
selenium.click("//input[@name='toggleMessagingProfile' and @value='2202']");
selenium.click("N103DC");
selenium.waitForPageToLoad("30000");
selenium.click("link=Logout");
selenium.waitForPageToLoad("30000");
}
}
3. When I try to execute it as JUnit Test, it opens browser and the code is not executed beyond that point. No login id or password is eneterd. Test reports no failure or errors.
Please help!
I'm very new to Selenium and stuck up with RC.
1. I'd started RC server and added RC client and JUnit to libraries
2. Recorded a script in IDE and the Java(Junit) code is as follows -
import com.thoughtworks.selenium.*;
public class Test2 extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://localhost:6080/", "*chrome");
}
public void test2() throws Exception {
selenium.open("/ui/");
selenium.type("loginUserId", "admin");
selenium.type("loginPassword", "Secret1");
selenium.click("N10063");
selenium.waitForPageToLoad("30000");
selenium.click("link=Fruit Enterprise");
selenium.waitForPageToLoad("30000");
selenium.click("//img[contains(@src,'http://localhost:6080/ui/default/00000000-000000/partycfg/navMessagingProfilesP.gif')]");
selenium.waitForPageToLoad("30000");
selenium.click("//input[@name='toggleMessagingProfile' and @value='2202']");
selenium.click("N103DB");
selenium.waitForPageToLoad("30000");
selenium.click("//input[@name='toggleMessagingProfile' and @value='2202']");
selenium.click("N103DC");
selenium.waitForPageToLoad("30000");
selenium.click("link=Logout");
selenium.waitForPageToLoad("30000");
}
}
3. When I try to execute it as JUnit Test, it opens browser and the code is not executed beyond that point. No login id or password is eneterd. Test reports no failure or errors.
Please help!
- metmanAmateur
- Posts : 58
Join date : 2010-04-02
Re: Selenium RC code not running
Fri May 07, 2010 12:10 am
What exactly happens? It loads your page? And it doesn't timeout?
Well, one thing, are you using jUnit 4 or later? Cause for newer versions of jUnit, you shouldn't be extending SeleneseTestCase, you should be using annotations. Not sure if that will fix your problems though.
Well, one thing, are you using jUnit 4 or later? Cause for newer versions of jUnit, you shouldn't be extending SeleneseTestCase, you should be using annotations. Not sure if that will fix your problems though.
- styagi_testing
- Posts : 7
Join date : 2010-05-06
Re: Selenium RC code not running
Fri May 07, 2010 1:16 am
Am using org.junit_3.8.2
- metmanAmateur
- Posts : 58
Join date : 2010-04-02
Re: Selenium RC code not running
Fri May 07, 2010 3:25 am
What are you seeing exactly? What are the last few lines in the RC runner browser window when you run it? One thing it might be is that you don't have any wait for after your open command, but that is only a guess.
- styagi_testing
- Posts : 7
Join date : 2010-05-06
Re: Selenium RC code not running
Fri May 07, 2010 12:27 pm
The jars in library -
1. junit-4.1.jar
2. selenium-java-client-driver.jar
3. selenium-java-client-driver-sources.jar
4. selenium-java-client-driver-tests.jar
5. selenium-java-client-driver-test-sources.jar
6. JRE System Library
Ran the code as JUnit Test.
The browser opens http://localhost:6080/ui/
Login Screen is displayed, with loginUserId and loginPassword
But no user id or password is typed in...
While if I play back the recorded test, it successfully types in login id and password and logs in
1. junit-4.1.jar
2. selenium-java-client-driver.jar
3. selenium-java-client-driver-sources.jar
4. selenium-java-client-driver-tests.jar
5. selenium-java-client-driver-test-sources.jar
6. JRE System Library
Ran the code as JUnit Test.
The browser opens http://localhost:6080/ui/
Login Screen is displayed, with loginUserId and loginPassword
But no user id or password is typed in...
While if I play back the recorded test, it successfully types in login id and password and logs in
- metmanAmateur
- Posts : 58
Join date : 2010-04-02
Re: Selenium RC code not running
Fri May 07, 2010 11:28 pm
Not sure. What does the RC command window say? When RC runs, it runs the test window and the runner window that has a spew/log in it that lists off the javascript that has been run as it is run. What are the last few lines of that when you run the script?
- styagi_testing
- Posts : 7
Join date : 2010-05-06
Re: Selenium RC code not running
Mon May 10, 2010 11:35 am
Are you asking about the Failure traces in JUnit?
In my case there are no failure traces. Its just that, the specifie window is opened and no further execution takes place. No login id is typed, no password entered... Test shows a running status but nothing happens.
In my case there are no failure traces. Its just that, the specifie window is opened and no further execution takes place. No login id is typed, no password entered... Test shows a running status but nothing happens.
- metmanAmateur
- Posts : 58
Join date : 2010-04-02
Re: Selenium RC code not running
Mon May 10, 2010 11:22 pm
It looks like you are running RC on local host. When the test kicks off, it should kick off 2 windows, the test runner that lists the JavaScript commands as they are run, and the broswer window with the system under test in it. At least this is how it works for me. I'm just wondering what the last command that is actually being run before things hang.
- styagi_testing
- Posts : 7
Join date : 2010-05-06
Re: Selenium RC code not running
Tue May 11, 2010 12:55 pm
Yes, it opens 2 windows. One for Selenium RC and other for the application under test.
Just to make sure, which is the last command being executed, I added few print statements -
public void test2() throws Exception {
System.out.println("0");
selenium.open("/ui/");
System.out.println("1");
selenium.type("loginUserId", "admin");
System.out.println("2");
selenium.type("loginPassword", "Secret1");
System.out.println("3");
selenium.click("N10063");
selenium.waitForPageToLoad("30000");
selenium.click("link=Fruit Enterprise");
selenium.waitForPageToLoad("30000");
selenium.click("//img[contains(@src,'http://localhost:6080/ui/default/00000000-000000/partycfg/navMessagingProfilesP.gif')]");
selenium.waitForPageToLoad("30000");
selenium.click("//input[@name='toggleMessagingProfile' and @value='2202']");
selenium.click("N103DB");
selenium.waitForPageToLoad("30000");
selenium.click("//input[@name='toggleMessagingProfile' and @value='2202']");
selenium.click("N103DC");
selenium.waitForPageToLoad("30000");
selenium.click("link=Logout");
selenium.waitForPageToLoad("30000");
}
}
Only 0 was printed on console.
System.out.println("1"); and beyond were not executed.
Command History in Selenium RC-
getTitle()
setContext(c8d38f94739b469b8101ada897891d94)
open(/ui/)
Just to make sure, which is the last command being executed, I added few print statements -
public void test2() throws Exception {
System.out.println("0");
selenium.open("/ui/");
System.out.println("1");
selenium.type("loginUserId", "admin");
System.out.println("2");
selenium.type("loginPassword", "Secret1");
System.out.println("3");
selenium.click("N10063");
selenium.waitForPageToLoad("30000");
selenium.click("link=Fruit Enterprise");
selenium.waitForPageToLoad("30000");
selenium.click("//img[contains(@src,'http://localhost:6080/ui/default/00000000-000000/partycfg/navMessagingProfilesP.gif')]");
selenium.waitForPageToLoad("30000");
selenium.click("//input[@name='toggleMessagingProfile' and @value='2202']");
selenium.click("N103DB");
selenium.waitForPageToLoad("30000");
selenium.click("//input[@name='toggleMessagingProfile' and @value='2202']");
selenium.click("N103DC");
selenium.waitForPageToLoad("30000");
selenium.click("link=Logout");
selenium.waitForPageToLoad("30000");
}
}
Only 0 was printed on console.
System.out.println("1"); and beyond were not executed.
Command History in Selenium RC-
getTitle()
setContext(c8d38f94739b469b8101ada897891d94)
open(/ui/)
- styagi_testing
- Posts : 7
Join date : 2010-05-06
Re: Selenium RC code not running
Tue May 11, 2010 1:08 pm
Starting Selenium RC server log -
10:34:32.774 INFO - Java: Sun Microsystems Inc. 1.5.0_19-b02
10:34:32.805 INFO - OS: Windows XP 5.1 x86
10:34:32.899 INFO - v2.0 [a2], with Core v2.0 [a2]
10:34:33.555 INFO - RemoteWebDriver instances should connect to: http://127.0.0.
1:4444/wd/hub
10:34:33.555 INFO - Version Jetty/5.1.x
10:34:33.555 INFO - Started HttpContext[/,/]
10:34:33.571 INFO - Started HttpContext[/selenium-server,/selenium-server]
10:34:33.571 INFO - Started HttpContext[/selenium-server/driver,/selenium-server
/driver]
10:34:33.836 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@181afa
3
10:34:33.836 INFO - Started HttpContext[/wd,/wd]
10:34:33.852 INFO - Started SocketListener on 0.0.0.0:4444
10:34:33.852 INFO - Started org.openqa.jetty.jetty.Server@5ac072
10:34:32.774 INFO - Java: Sun Microsystems Inc. 1.5.0_19-b02
10:34:32.805 INFO - OS: Windows XP 5.1 x86
10:34:32.899 INFO - v2.0 [a2], with Core v2.0 [a2]
10:34:33.555 INFO - RemoteWebDriver instances should connect to: http://127.0.0.
1:4444/wd/hub
10:34:33.555 INFO - Version Jetty/5.1.x
10:34:33.555 INFO - Started HttpContext[/,/]
10:34:33.571 INFO - Started HttpContext[/selenium-server,/selenium-server]
10:34:33.571 INFO - Started HttpContext[/selenium-server/driver,/selenium-server
/driver]
10:34:33.836 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@181afa
3
10:34:33.836 INFO - Started HttpContext[/wd,/wd]
10:34:33.852 INFO - Started SocketListener on 0.0.0.0:4444
10:34:33.852 INFO - Started org.openqa.jetty.jetty.Server@5ac072
- styagi_testing
- Posts : 7
Join date : 2010-05-06
Re: Selenium RC code not running
Tue May 11, 2010 1:14 pm
Tried another test, that can be replicated anywhere...
Test Script -
package com.example.tests;
import com.thoughtworks.selenium.*;
public class Test2 extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://www.irctc.co.in/", "*chrome");
}
public void test3() throws Exception {
selenium.open("/");
selenium.type("userName", "selen123");
selenium.type("password", "123456");
selenium.click("Button1");
selenium.waitForPageToLoad("30000");
selenium.click("link=Log Out");
selenium.waitForPageToLoad("30000");
}
}
It also gets stuck at the same point as previous one.
Selenium RC command history -
getTitle()
setContext(129d3a53b2df458f9ef40dd3e79f7e7c)
open(/)
Failure Trace-
com.thoughtworks.selenium.SeleniumException: XHR ERROR: URL = http://www.irctc.co.in/ Response_Code = -1 Error_Message = Request Error
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
at com.thoughtworks.selenium.DefaultSelenium.open(DefaultSelenium.java:335)
at com.example.tests.Test2.test3(Test2.java:10)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:212)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Test Script -
package com.example.tests;
import com.thoughtworks.selenium.*;
public class Test2 extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://www.irctc.co.in/", "*chrome");
}
public void test3() throws Exception {
selenium.open("/");
selenium.type("userName", "selen123");
selenium.type("password", "123456");
selenium.click("Button1");
selenium.waitForPageToLoad("30000");
selenium.click("link=Log Out");
selenium.waitForPageToLoad("30000");
}
}
It also gets stuck at the same point as previous one.
Selenium RC command history -
getTitle()
setContext(129d3a53b2df458f9ef40dd3e79f7e7c)
open(/)
Failure Trace-
com.thoughtworks.selenium.SeleniumException: XHR ERROR: URL = http://www.irctc.co.in/ Response_Code = -1 Error_Message = Request Error
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
at com.thoughtworks.selenium.DefaultSelenium.open(DefaultSelenium.java:335)
at com.example.tests.Test2.test3(Test2.java:10)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:212)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
- arunvr
- Posts : 1
Join date : 2011-12-01
Re: Selenium RC code not running
Thu Dec 01, 2011 8:48 pm
Hi, I am facing the same problem. Is there a solution for this ? If you have already got a solution, please help me.
- Arun.
- Arun.
- i faced a problem during running the code in selenium rc please solve it
- Error message being displayed while running a code in Java (JUnit4) in selenium Rc .
- For every change in the code of selenium RC, Is that necesary to compile the selenium RC code every time.
- [Help] Problem of running selenium Testcase[Java Junit] with Selenium RC
- Getting Firefox Browser already running pop-up frequently while executing test code
Permissions in this forum:
You cannot reply to topics in this forum