| Author |
Selenium RC Junit test case does not execute.
|
Divya Sudarsan
Greenhorn
Joined: Feb 16, 2010
Posts: 4
|
|
Hi ,
I am currently learning selenium RC. I tried to run my junit selenium test case, it opens two firefox windows and then wait for the web page http://localhost:4444/selenium-server/core/Blank.html?start=true on one of the windows and eventually times out.
The web page intended to open also doesnt open.
Please let me know the issue.
SELENIUM SERVER LOG :
22:45:36.145 INFO - Command request: getNewBrowserSession[*firefox, http://www.g
oogle.com/, ] on session null
22:45:36.145 INFO - creating new remote session
22:45:36.145 INFO - Allocated session 9d0e1f4b80854fd3a02c6b048f621e65 for http:
//www.google.com/, launching...
22:45:36.192 INFO - Preparing Firefox profile...
22:45:38.380 INFO - Launching Firefox...
22:45:40.489 INFO - Got result: OK,9d0e1f4b80854fd3a02c6b048f621e65 on session 9
d0e1f4b80854fd3a02c6b048f621e65
22:45:40.489 INFO - Command request: open[/, ] on session 9d0e1f4b80854fd3a02c6b
048f621e65
22:46:10.613 INFO - Got result: Timed out after 30000ms on session 9d0e1f4b80854
fd3a02c6b048f621e65
22:46:10.613 INFO - Command request: testComplete[, ] on session 9d0e1f4b80854fd
3a02c6b048f621e65
22:46:10.613 INFO - Killing Firefox...
22:46:10.769 INFO - Got result: OK on session 9d0e1f4b80854fd3a02c6b048f621e65
My Junit Code
// We specify the package of our tests
import com.thoughtworks.selenium.*;
// This is the driver's import. You'll use this for instantiating a
// browser and making it do what you need.
public class HelloSeleniumTest extends SeleneseTestCase {
// We create our Selenium test case
public void setUp() throws Exception {
setUp("http://www.google.com/", "*firefox");
// We instantiate and start the browser
}
public void testNew() throws Exception {
selenium.open("/");
selenium.type("q", "selenium rc");
selenium.click("btnG");
selenium.waitForPageToLoad("30000");
assertTrue(selenium.isTextPresent("Results * for selenium rc"));
// These are the real test steps
}
}
Thanks,
Divya
|
 |
Kiran Shigli
Greenhorn
Joined: Oct 04, 2008
Posts: 7
|
|
Try putting the mozilla home directory path in the env variable PATH.
Kiran
|
 |
rumija ho
Greenhorn
Joined: May 24, 2011
Posts: 2
|
|
Hii
I am also getting the same type of error with IE. For the first time when i run it is redirecting to C:\Users\<login user>\AppData\Local\Temp\customProfileDir*\core\Blank.html.
and in the server log :
15:14:14.755 INFO - Java: Sun Microsystems Inc. 16.3-b01
15:14:14.755 INFO - OS: Windows 7 6.1 x86
15:14:14.755 INFO - v1.0-beta-2 [2571], with Core v1.0-beta-2 [2330]
15:14:14.815 INFO - Version Jetty/5.1.x
15:14:14.815 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
15:14:14.815 INFO - Started HttpContext[/selenium-server,/selenium-server]
15:14:14.815 INFO - Started HttpContext[/,/]
15:14:14.825 INFO - Started SocketListener on 0.0.0.0:4444
15:14:14.825 INFO - Started org.mortbay.jetty.Server@f73c1
15:14:19.614 INFO - Checking Resource aliases
15:14:19.624 INFO - Command request: getNewBrowserSession[*iexplore, http://localhost:8080/test, ] on session null
15:14:19.624 INFO - creating new remote session
15:14:19.754 INFO - Allocated session 4ec4ea0a2db742d59c0aa64098f34775 for http://localhost:8080/test, launching...
15:14:19.814 INFO - Launching Embedded Internet Explorer...
15:14:20.824 INFO - Launching Internet Explorer HTA...
and stops for some time after that it is showing the timeout errormessage.
Please help me on this.
Thanks
|
 |
s lekkala
Greenhorn
Joined: Jul 25, 2011
Posts: 14
|
|
Hi,
I am new to selenium. I have doubts in the code can anyone clarify it...
why we should use setUp() and tearDown() methods...???
and its not working is there any mistake in the code??
package com.sreenu;
import com.thoughtworks.selenium.Selenium;
import com.thoughtworks.selenium.DefaultSelenium;
import junit.framework.TestCase;
import org.openqa.selenium.server.SeleniumServer;
public class ExampleTest
extends TestCase
{
private static final String MAX_WAIT_TIME_IN_MS = "60000";
private static final String BASE_URL = "http://www.google.com";
private Selenium selenium = new DefaultSelenium( "localhost",
4444,
"*firefox",
BASE_URL);
private SeleniumServer seleniumServer;
public void setUp()
throws Exception
{
seleniumServer = new SeleniumServer();
seleniumServer.start();
selenium.start();
}
public void tearDown()
throws Exception
{
selenium.stop();
seleniumServer.stop();
}
public void testClickingLink()
throws Exception
{
selenium.open(BASE_URL);
Thread.sleep(20000);
selenium.click("css=a.gbzt.gbzt-hvr > span.gbts");
Thread.sleep(30000);
selenium.type("Email", "gmail address");
selenium.type("Passwd", "password");
selenium.click("signIn");
selenium.waitForPageToLoad(MAX_WAIT_TIME_IN_MS);
//String expectedTitle = "Bit Motif ยป Test Page For Selenium Remote Control";
//assertEquals(expectedTitle, selenium.getTitle());
}
}
Regards,
Seenuuuuuu..
|
 |
 |
|
|
subject: Selenium RC Junit test case does not execute.
|
|
|