51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 5028|回复: 4
打印 上一主题 下一主题

[求助] Selenium 回放问题

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2012-7-19 16:16:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Selenium IDE version:1.8.1
Firefox version:14.0
OS: Windows 7

在selenium IDE上随便录制个简单的脚本,然后回放报这个错误:
[error] isNewPageLoaded found an old pageLoadError: Error: Permission denied for <http:xxxx> to get property Location.href
[error] 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
请问出现这些问题的原因是什么?谢谢!
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 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();
        }
}
回复 支持 反对

使用道具 举报

该用户从未签到

3#
发表于 2013-1-1 20:23:19 | 只看该作者
需加firefox的路径到path中,重启生效
回复 支持 反对

使用道具 举报

该用户从未签到

4#
发表于 2013-1-7 15:50:54 | 只看该作者
是否是3楼所说的那样呢?期待楼主验证^^
回复 支持 反对

使用道具 举报

该用户从未签到

5#
发表于 2014-11-13 17:53:34 | 只看该作者
最后怎么解决的啊?
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-4-28 15:35 , Processed in 0.083430 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表