How to run the Selenium RC script using webDriver2.3?

152 views
Skip to first unread message

Santosh B

unread,
Aug 19, 2011, 4:09:00 AM8/19/11
to Selenium Users, santos...@gmail.com
I am a new user of webdriver. I already have the regression test
framework using selenium 1.0.3.
Now we are plannning to upgrade the present framework to selenium
webdriver. while trying to run the RC script on Webdriver, I am
getting the following failure trace:

java.lang.RuntimeException: Could not contact Selenium Server; have
you started it on 'localhost:4444' ?
Read more at http://seleniumhq.org/projects/remote-control/not-started.html
Connection refused: connect
at
com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:
87)
at
com.thoughtworks.selenium.SeleneseTestBase.setUp(SeleneseTestBase.java:
132)
at
com.thoughtworks.selenium.SeleneseTestBase.setUp(SeleneseTestBase.java:
99)
at
com.thoughtworks.selenium.SeleneseTestCase.setUp(SeleneseTestCase.java:
80)
at testdriver.testRC.setUp(testRC.java:16)
at junit.framework.TestCase.runBare(TestCase.java:132)
at
com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:
228)
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)

Please let me know what all changes required in the below RC script to
run on the Web driver without running the selenium server.

/*Selenium RC Script start*/
package testdriver;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

import com.thoughtworks.selenium.*;

public class testRC 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("10000");
assertTrue(selenium.isTextPresent("Google"));
}
}

Luke Inman-Semerau

unread,
Aug 19, 2011, 3:45:25 PM8/19/11
to seleniu...@googlegroups.com, santos...@gmail.com
You need to use the WebDriverBackedSelenium class:

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


Santosh B

unread,
Aug 22, 2011, 1:50:11 AM8/22/11
to Selenium Users

Santosh B

unread,
Aug 22, 2011, 2:07:46 AM8/22/11
to Selenium Users
Thanks Luke,

As per the help given on the link mentioned by you, I need to replace
the below code:

Selenium selenium = new DefaultSelenium(
"localhost", 4444, "*firefox", "http://www.yoursite.com");
selenium.start();

with the below code:
WebDriver driver = new FirefoxDriver();
Selenium selenium = new WebDriverBackedSelenium(driver, "http://
www.yoursite.com");

However I am not using any class as below in my script:
Selenium selenium = new DefaultSelenium(
"localhost", 4444, "*firefox", "http://www.yoursite.com");
selenium.start();

What changes I need to do in my Selenium RC script

Thanks,
Santosh B


On Aug 20, 12:45 am, Luke Inman-Semerau <luke.seme...@gmail.com>
wrote:
> >http://groups.google.com/group/selenium-users?hl=en.- Hide quoted text -
>
> - Show quoted text -

Krishnan Mahadevan

unread,
Aug 22, 2011, 3:35:55 AM8/22/11
to seleniu...@googlegroups.com
You are extending from "SeleneseTestCase".

You would need to get out of that mode, and start working with WebDriverBackedSelenium instance.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
Reply all
Reply to author
Forward
0 new messages