【问题标题】:Not able to run portractor tests in Chrome无法在 Chrome 中运行量角器测试
【发布时间】:2017-05-04 13:17:35
【问题描述】:

我无法在 Chrome 浏览器中运行我的样例量角器测试。

这是我的 config.js 文件。

exports.config = {


    capabilities: {
    "browserName": "chrome",
    "chromeOptions": {
        binary: "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe",
        args: [],
        extensions: [],
    }
},
  seleniumAddress: 'http://localhost:4444/wd/hub',

  onPrepare: function() {
    var width = 1600;
    var height = 1200;
    browser.driver.manage().window().setSize(width, height);
},
  specs: ['C:/Users/Desktop/spec.js'],
};

这里是 spec.js 文件

describe('Guru99 Test', function() {
 it('should add a Name as GURU99', function() {
  browser.get('www.guru99.com');
    //expect(browser.getTitle().toEqual("Meet guru99"))
  element(by.xpath("//*[@href='/software-testing.html']")).click();
  var guru= element(by.xpath('html/body/div[2]/div[1]/div[2]/div[2]/div/h3'));
  expect(guru.getText()).toEqual('Hello change GURU99!');
browser.driver.sleep(5000);
  });
});

它打开chrome,输入数据;进入 URL,然后同样输入 HTML 标签,片刻然后打开 URL 但什么也不做......

如何解决这个问题?

Chrome 版本 - 58.0 量角器版本 - 5.1.1

提前致谢。

【问题讨论】:

  • 确保您运行的是最新版本的chromedriver
  • 是的,在运行测试之前应用了命令webdriver-manager update。我相信更新了 chromedriver。
  • 在从 onPrepare 方法中删除 browser.driver.manage().window().setSize(width, height); 后,您可以尝试再次运行它吗?
  • 我通过将 http 放在 URL 之前并独立运行 selenium 来使这段代码正常工作

标签: javascript automation protractor


【解决方案1】:

这个问题是通过放置http://www.guru99.com,而不是www.guru99.com,并独立运行selenium来解决的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-05-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多