0

enter image description hereI am running these 3 tests on Selenium ID,

enter image description here

but i want to run these tests in parallel on different browsers , for that i am trying to use Selenium Grid and referring this http://code.google.com/p/selenium/wiki/Grid2

for that i am using this code

                 public class testjava extends SeleneseTestCase {
@Before
public void setUp() throws Exception {
    selenium = new DefaultSelenium("localhost", 4444, "*chrome", "www.yahoo.com/");
    selenium.start();
}

@Test
public void testTestjava() throws Exception {
}

@After
public void tearDown() throws Exception {
    selenium.stop();
}

}

but i am getting this exception

              java.lang.NoSuchMethodError: org.apache.http.conn.scheme.Scheme.<init>(Ljava/lang/String;ILorg/apache/http/conn/scheme/SchemeSocketFactory;)V
at org.openqa.selenium.remote.internal.HttpClientFactory.getClientConnectionManager(HttpClientFactory.java:57)
at org.openqa.selenium.remote.internal.HttpClientFactory.<init>(HttpClientFactory.java:47)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:211)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:102)
at com.selenium.testjava.setUp(testjava.java:20)
at junit.framework.TestCase.runBare(TestCase.java:128)
at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:230)
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:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Thanks

0

2 Answers 2

1

The DefaultSelenium is for Selenium 1 (RC)-compability. localhost is your RC-server (it's the seleniumserver).

But I would recommend you use Selenium 2. Like it says in your link you have to do the following:

DesiredCapabilities capability = DesiredCapabilities.firefox();
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability); //localhost is your hub here

This is a simple example, it requests firefox in your grid. you can specify any browser on any platform:

capability.setBrowserName(“firefox”); 
capability.setPlatform(“LINUX”);  
capability.setVersion(“3.6”);

And you need at least one node that you register to the hub like this:

java -jar selenium-server-standalone-2.x.0.jar -role wd -hub http://localhost:4444/grid/register -browser browserName=firefox,version=3.6,platform=LINUX

Again it is assumed Selenium hub is running on localhost. I hope this helps as a start. Just ask if you have any further questions.

Sign up to request clarification or add additional context in comments.

19 Comments

Thanks , i know its very basic Q , but i couldnt understand where will i write this code : DesiredCapabilities capability = DesiredCapabilities.firefox(); ? and secondly i want to run one of my testcase in firefox but other in chrome ,what will i do for that
capability.setBrowserName(“firefox”); or capability.setBrowserName(“chrome”); But for chrome you need to start the chromeserver first on the machine where you want to run the test in chrome: code.google.com/p/selenium/wiki/ChromeDriver
thanks, but my first question remains there where will i write this code : DesiredCapabilities capability = DesiredCapabilities.firefox(); as i am using selenium IDE, not eclipse..
Sry, but IDE is a firefox plugin that only works locally in Firefox. You can export the test scripts in any language (for example Java) and execute them in eclipse.
thanks, just did that , now in eclipse it says : not resolved: import com.thoughtworks.selenium , which selenium jar i should put for that?
|
0

You need to use JUnit 4 in combination with Selenium.

Copy your JUnit 4 Selenium test into Eclipse.

Write the start up of the Firefox Profile and furthermore DesiredCapabilities capability = DesiredCapabilities.firefox(); into @Before

Start the Hub, start the Node, run your tests.

But I suggest you read the basic tutorials about JUnit 4 and Selenium Testing in JUnit 4. Just Google to find your solution.

Java knowledge also helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.