【问题标题】:"setNetworkConditions" in protractor e2e tests says not a function量角器 e2e 测试中的“setNetworkConditions”表示不是函数
【发布时间】:2018-05-09 05:50:48
【问题描述】:

我正在尝试使用

driver.setNetworkConditions({ offline : true });

在我的代码中,但它说Failed: _protractor.browser.driver.setNetworkConditions is not a function

这是我的访问代码。

     import { browser } from 'protractor';

        describe('disable browser network', () => {
            "use strict";
            let browserA = browsers.a;
            it('should disable chrome network', () => {
                browserA.ignoreSynchronization = true;
                browser.driver.setNetworkConditions({ offline: true });
                //..... my other functionality here
            });
           afterAll(() => {
           browserA.quit();
           });
        });

【问题讨论】:

  • @HaC 我实际上希望在我的测试用例中而不是在配置级别。所以它不是重复的。我也无法访问这个。

标签: selenium selenium-webdriver jasmine protractor e2e-testing


【解决方案1】:

我已经找到了解决方案,实际上我只需要全局更新我的 npm protractor 包

npm install protractor -g

还有一件事是在package.json中将protractor的包版本更新为5.2.0,然后再次运行npm install命令更新node_modules

那么这个东西很好用。

browser.driver.setNetworkConditions({
            offline: true, //I needed to set it offline intentionally
            latency: 150,
            download_throughput: 450 * 1024,
            upload_throughput: 150 * 1024
        });

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多