문제

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

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top