【问题标题】:How to launch chrome browser using selenium如何使用 selenium 启动 chrome 浏览器
【发布时间】:2013-02-20 08:13:10
【问题描述】:

当我尝试使用 selenium 启动 chrome 浏览器时,它会抛出错误。

我在我的代码中使用这个命令 "selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://www.google.com/");

【问题讨论】:

标签: google-chrome selenium


【解决方案1】:

如果您想启动 Google Chrome,则必须使用“*chrome”以外的其他内容。

在交互模式下使用 Selenium RC,像这样

$ java -jar selenium-server.jar -interactive 并且不正确地使用 getNewBrowserSession 命令:

cmd=getNewBrowserSession 我得到支持的浏览器列表:

23:43:09.317 信息 - 得到结果:无法启动新的浏览器会话:不支持浏览器: (你忘了加*吗?)

支持的浏览器包括: *火狐 *嘲笑 *火狐代理 *pifirefox *铬合金 *iexploreproxy *探索 *火狐3 *safariproxy *谷歌浏览器 *征服者 *火狐2 *苹果浏览器 *pii探索 *火狐浏览器 *歌剧 *iehta *风俗 在会话空 所以,我猜你应该能够使用“*googlechrome”而不是“*chrome”来启动 Google Chrome。

-参考-帕斯卡·马丁爵士。 :D

【讨论】:

    【解决方案2】:

    你在使用 Selenium RC 吗?

    我用的是WebDriver,我用来打开Chrome的代码是:

    System.setProperty("webdriver.chrome.driver", "<localpath of Chrome driver>");
    WebDriver chromeobj = new ChormeDriver();
    chromeobj.get("www.google.com");
    

    【讨论】:

      猜你喜欢
      • 2021-05-16
      • 1970-01-01
      • 2017-05-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-10
      • 2018-10-31
      相关资源
      最近更新 更多