Selenium Server无法启动

时间:2013-07-03 11:08:30

标签: selenium selenium-server

package com.memoir.client.widgets.memogen;

import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.thoughtworks.selenium.DefaultSelenium;

@SuppressWarnings("deprecation")
public class TestHomepage extends SeleneseTestCase {
    @Override
    @Before
    public void setUp() throws Exception {
        //selenium = new DefaultSelenium("localhost", 4444, "*firefox", "https://64.79.128.233/staging/");
        selenium = new DefaultSelenium("localhost", 4444, "*firefox /usr/bin/firefox", "https://64.79.128.233/staging/");
        selenium.start();
    }

    @Test
    public void testTesting4() throws Exception {
        selenium.setSpeed("2000");
        selenium.windowMaximize();
        //selenium.open("/memosyn/");
        selenium.open("/staging/");
        selenium.waitForPageToLoad("60000");
        //Checking for page layout in the beginning of the web page
        assertEquals("1", selenium.getElementIndex("//*[@id='isc_G']"));
        assertEquals("Please contact support@systems.com for questions or comments.", selenium.getText("id=contactText"));
        //assertEquals("MemoWeb V3.3.5963M", selenium.getText("//*[@id='isc_WidgetCanvas_1_widget']/div/table/tbody/tr/td[2]"));
        assertEquals("14", selenium.getElementHeight("scLocator=//VLayout[ID=\"loginBox\"]/"));
        assertEquals("447", selenium.getElementWidth("scLocator=//VLayout[ID=\"loginBox\"]/"));
        assertEquals("35", selenium.getElementHeight("scLocator=//DynamicForm[ID=\"loginItems\"]/item[name=email]/title"));
        assertEquals("207", selenium.getElementWidth("scLocator=//DynamicForm[ID=\"loginItems\"]/item[name=email]/title"));
        assertEquals("35", selenium.getElementHeight("scLocator=//DynamicForm[ID=\"loginItems\"]/item[name=password]/title"));
        assertEquals("207", selenium.getElementWidth("scLocator=//DynamicForm[ID=\"loginItems\"]/item[name=password]/title"));
        assertEquals("35", selenium.getElementHeight("scLocator=//DynamicForm[ID=\"loginItems\"]/item[name=rememberMe]/textbox"));
        assertEquals("203", selenium.getElementWidth("scLocator=//DynamicForm[ID=\"loginItems\"]/item[name=rememberMe]/textbox"));
        assertEquals("22", selenium.getElementHeight("scLocator=//Button[ID=\"submitButton\"]/"));
        assertEquals("100", selenium.getElementWidth("scLocator=//Button[ID=\"submitButton\"]/"));
        assertEquals("MemoWeb", selenium.getTitle());
        assertEquals("Email :", selenium.getText("scLocator=//DynamicForm[ID=\"loginItems\"]/item[name=email||title=Email]/title"));
        assertEquals("Password :", selenium.getText("scLocator=//DynamicForm[ID=\"loginItems\"]/item[name=password||title=Password]/title"));
        assertEquals("Remember me on this computer", selenium.getText("scLocator=//DynamicForm[ID=\"loginItems\"]/item[name=rememberMe||title=Remember%20me%20on%20this%20computer]/textbox"));
    }

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

这是代码,当我通过启动selenium服务器运行时,我收到此错误。 可能是错误的原因是什么?我的firefox配置文件设置不正确吗?

java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: org.openqa.selenium.server.browserlaunchers.InvalidBrowserExecutableException: The specified path to the browser executable is invalid.
    at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:109)
    at com.memoir.client.widgets.memogen.TestHomepage.setUp(TestHomepage.java:16)
    at junit.framework.TestCase.runBare(TestCase.java:132)
    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:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
    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)
Caused by: com.thoughtworks.selenium.SeleniumException: Failed to start new browser session: org.openqa.selenium.server.browserlaunchers.InvalidBrowserExecutableException: The specified path to the browser executable is invalid.
    at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:112)
    at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:106)
    at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:275)
    at com.thoughtworks.selenium.HttpCommandProcessor.start(HttpCommandProcessor.java:237)
    at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:100)
    ... 16 more

任何人都可以帮我解决这个问题吗? 我得到了这些错误,我不知道请帮助我。

1 个答案:

答案 0 :(得分:0)

Selenium RC适用于Eclipse,版本低于12。你能检查一下你正在使用哪个版本