changxiaofang 发表于 2012-7-19 16:16:19

Selenium 回放问题

Selenium IDE version:1.8.1
Firefox version:14.0
OS: Windows 7

在selenium IDE上随便录制个简单的脚本,然后回放报这个错误:
isNewPageLoaded found an old pageLoadError: Error: Permission denied for <http:xxxx> to get property Location.href
Permission denied for <http://xxxxx> to get property Location.href

考虑到可能是同源策略问题导致不成功,就将测试用例导出为java脚本,然后使用selenium RC放在eclipse 中运行,出现这个问题:

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:100)
        at test1.setUp(test1.java:11)
        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:232)
        at junit.framework.TestSuite.run(TestSuite.java:227)
        at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
        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:92)
        ... 16 more
请问出现这些问题的原因是什么?谢谢!

changxiaofang 发表于 2012-7-19 16:24:19

在eclipse中运行的代码如下:

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

public class test1 extends SeleneseTestCase {
        @Before
        public void setUp() throws Exception {
                selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.baidu.com/");
                selenium.start();
        }

        @Test
        public void testTest1() throws Exception {
                selenium.open("/");
                selenium.click("link=知道");
                selenium.waitForPageToLoad("30000");
        }

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

bearofworld 发表于 2013-1-1 20:23:19

需加firefox的路径到path中,重启生效

Trista_Small 发表于 2013-1-7 15:50:54

是否是3楼所说的那样呢?期待楼主验证^^

hellolela 发表于 2014-11-13 17:53:34

最后怎么解决的啊?
页: [1]
查看完整版本: Selenium 回放问题