开发者

Failure running junit test. Can`t create new browser session

Got eclipse helios; junit, selenium-java-client-driver, selenium-server libs. Added libs to project as external jars. Wrote simple test:

import com.thoughtworks.selenium.SeleneseTestCase;

public class FirstTest extends SeleneseTestCase{

    public void setUp() throws Exception {
       setUp("nedoma.com.ua", "*googlechrome");
    }

    public void testSignIn() {
        String login = "XXXXX";
        String password = "XXXXXXXXXX";

        selenium.open("nedoma.com.ua");
        selenium.click("Увійти");
        selenium.type("login" , login );
        selenium.type("password" , password );
        selenium.submit("Увійти");

        selenium.open("http://nedoma.com.ua/settings/profile/");
        assertEquals(selenium.getText("profile_name").toLowerCase(), login.toLowerCase());
        selenium.close();
    }

Ran selenium-server.jar in cmd using "java -jar selenium-server.jar -multiWindow" command Ran test as junit test.

The problem is: Got failure trace:

java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: Error while launching browser
    at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:89)
    at com.thoughtworks.selenium.SeleneseTestBase.setUp(SeleneseTestBase.java:123)
    at com.thoughtworks.selenium.SeleneseTestBase.setUp(SeleneseTestBase.java:104)
    at com.thoughtworks.selenium.SeleneseTestCase.setUp(SeleneseTestCase.java:78)
    at src.testSuit.FirstTest.setUp(FirstTest.java:10)
    at junit.framework.TestCase.runBare(TestCase.java:132)
    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:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.Te开发者_如何学CstSuite.run(TestSuite.java:238)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
    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)
Caused by: com.thoughtworks.selenium.SeleniumException: Failed to start new browser session: Error while launching browser
    at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
    at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
    at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:262)
    at com.thoughtworks.selenium.HttpCommandProcessor.start(HttpCommandProcessor.java:223)
    at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:81)
    ... 19 more

What did I do wrong? Please, help. Waiting for any suggestions.

P.S. Tried using *googlechrome with the same result as *chrome or *firefox.


Try starting the Selenium server within the setUp() function of your code, as -

RemoteControlConfiguration settings = new RemoteControlConfiguration();    
settings.setReuseBrowserSessions(true);
settings.setSingleWindow(false);    
SeleniumServer seleniumserver=new SeleniumServer(settings);
seleniumserver.boot();
seleniumserver.start();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜