51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 3586|回复: 3
打印 上一主题 下一主题

SeleniumIDE转化成JAVA脚本,在RC环境下跑 报错

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2015-6-4 23:21:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
错误日志如下:
java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: org.openqa.selenium.server.RemoteCommandException: Error while launching browser
        at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:109)
        at com.test.test.setUp(test.java:15)
        at junit.framework.TestCase.runBare(TestCase.java:139)
        at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:248)
        at junit.framework.TestResult$1.protect(TestResult.java:122)
        at junit.framework.TestResult.runProtected(TestResult.java:142)
        at junit.framework.TestResult.run(TestResult.java:125)
        at junit.framework.TestCase.run(TestCase.java:129)
        at junit.framework.TestSuite.runTest(TestSuite.java:255)
        at junit.framework.TestSuite.run(TestSuite.java:250)
        at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
        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:459)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: com.thoughtworks.selenium.SeleniumException: Failed to start new browser session: org.openqa.selenium.server.RemoteCommandException: Error while launching browser
        at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:109)
        at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:103)
        at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:272)
        at com.thoughtworks.selenium.HttpCommandProcessor.start(HttpCommandProcessor.java:234)
        at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:100)
        ... 16 more


执行代码如下:
package com.test;

import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.regex.Pattern;
import junit.framework.TestCase;

public class test extends SeleneseTestCase {
    @Before
    public void setUp() throws Exception {
        selenium = new DefaultSelenium("localhost", 4444, "*chrome C:/Users/Admin/AppData/Local/Google/Chrome/Application/chrome.exe", "http://www.baidu.com/");

        selenium.start();
    }

    @Test
    public void testTest() throws Exception {
        selenium.open("/");

        selenium.type("id=kw", "selenium");
        selenium.click("id=su");

    }

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







分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

  • TA的每日心情
    擦汗
    2017-10-27 14:21
  • 签到天数: 306 天

    连续签到: 1 天

    [LV.8]测试军长

    2#
    发表于 2015-6-5 10:37:06 | 只看该作者
    楼主是否运行:java -jar selenium-server-standalone-2.39.0.jar
    这种之类的jar文件?

    评分

    参与人数 1测试积点 +10 收起 理由
    lsekfe + 10 恭喜你获得测试积点10

    查看全部评分

    回复 支持 反对

    使用道具 举报

    该用户从未签到

    3#
     楼主| 发表于 2015-6-5 12:57:25 | 只看该作者
    嗯嗯!执行了!也是正常执行的!
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    擦汗
    2017-10-27 14:21
  • 签到天数: 306 天

    连续签到: 1 天

    [LV.8]测试军长

    4#
    发表于 2015-6-8 08:59:41 | 只看该作者
    wang@1987 发表于 2015-6-5 12:57
    嗯嗯!执行了!也是正常执行的!

    你换其他浏览器试了吗?例如IE 或 FireFox
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

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

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

    GMT+8, 2024-5-7 04:50 , Processed in 0.067165 second(s), 23 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

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