【问题标题】:How to do automation testing of your website on firefox ? (webdriverio)如何在 Firefox 上对您的网站进行自动化测试? (webdriverio)
【发布时间】:2018-07-16 11:27:24
【问题描述】:

我是自动化测试的新手。我按照“http://webdriver.io/guide.html”中给出的步骤进行操作,一切顺利。 我安装了 节点.js selenium-server-standalone-3.5.3 壁虎司机 铬河

我的脚本是这样的:

var webdriverio = require(.\\webdriverio');
     var options = {
       desiredCapabilities: {
       browserName: 'C:\Program Files\Mozilla Firefox\firefox'
     }
 };

 webdriverio
   .remote(options)
   .init()
   .url('http://www.google.com')
   .getTitle().then(function(title) {
    console.log('Title was: ' + title);
 })
 .end()
 .catch(function(err) {
    console.log(err);
 });

这很好用,但它会在我想打开 Firefox 的地方打开 chrome 浏览器。

【问题讨论】:

  • 浏览器名不就是firefox吗?你已经给出了路径。猜猜这是不对的。
  • 在这种情况下会出错。我也试过了。错误:类型:'SessionNotCreatedException',消息:'无法创建新会话。',
  • 错误是什么?
  • 类型:'SessionNotCreatedException',消息:'无法创建新会话。',无法创建新服务:GeckoDriverService
  • 看起来 GeckoDriver 不是最新的或不在路径中。 Selenium 无法找到它。可能您需要将系统属性显式设置为驱动程序的路径。

标签: node.js selenium selenium-webdriver geckodriver


【解决方案1】:

切换浏览器名称:'C:\Program Files\Mozilla Firefox\firefox' 只是 browserName: 'firefox'

【讨论】:

    猜你喜欢
    • 2021-10-28
    • 2015-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多