Selenium - 无法启动Selenium会话:无法启动新的浏览器会话:启动浏览器时出错 [英] Selenium - Could not start Selenium session: Failed to start new browser session: Error while launching browser

查看:666
本文介绍了Selenium - 无法启动Selenium会话:无法启动新的浏览器会话:启动浏览器时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Selenium的新手。我生成了我的第一个java selenium测试用例,它已成功编译。但是当我运行该测试时,我得到以下RuntimeException

I am new to Selenium. I generated my first java selenium test case and it has compiled successfully. But when I run that test I got the following RuntimeException

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:88>

请告诉我如何解决此错误。

Kindly tell me how can I fix this error.

这是我想要运行的java文件。

This is the java file I want to run.

import com.thoughtworks.selenium.*;

import java.util.regex.Pattern;

import junit.framework.*;

public class orkut extends SeleneseTestCase {

 public void setUp() throws Exception {

  setUp("https://www.google.com/", "*chrome");

 }
 public void testOrkut() throws Exception {

  selenium.setTimeout("10000");

  selenium.open("/accounts/ServiceLogin?service=orkut&hl=en-US&rm=false&continue=http%3A%2F%2Fwww.orkut.com%2FRedirLogin%3Fmsg%3D0&cd=IN&skipvpage=true&sendvemail=false");

  selenium.type("Email", "username");

  selenium.type("Passwd", "password");

  selenium.click("signIn");

  selenium.selectFrame("orkutFrame");

  selenium.click("link=Communities");

  selenium.waitForPageToLoad("10000");

 }

 public static Test suite() {

  return new TestSuite(orkut.class);

 }

 public void tearDown(){

  selenium.stop();

 }

 public static void main(String args[]) {

  junit.textui.TestRunner.run(suite());

 }

}

我刚开始selenium服务器通过命令提示符,然后通过另一个命令提示符执行上面的java文件。

I first started the selenium server through the command prompt and then execute the above java file through another command prompt.

第二个问题:我是否可以右键单击网页上的指定位置硒。

Second Question: Can I do right click on a specified place on a webpage with selenium.

推荐答案

如果您使用的是最新版本的Selenium RC(1.0之后),您应该更改以下内容:

If you're using the last version of Selenium RC (after 1.0) you should change the following:

setUp("https://www.google.com/", "*chrome");

setUp("https://www.google.com/", "*firefox");

如果这不起作用,请尝试创建一个单独的firefox配置文件并使用该配置文件:

If this doesn't work, try creating a separate firefox profile and using that one:

http:// seleniumhq.org/docs/05_selenium_rc.html#specifying-the-firefox-profile

这篇关于Selenium - 无法启动Selenium会话:无法启动新的浏览器会话:启动浏览器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆