量角器测试在chrome中失败

时间:2018-05-22 19:00:57

标签: google-chrome protractor

Chrome中的测试失败并显示错误:失败:找不到使用的元素。在Firefox中工作正常。

describe("Main page functionality", () => {

var mainPage;
var url = "https://prom.ua/ua/";
var request = 'iphone';

beforeEach(() => {
    browser.ignoreSynchronization = true;
    browser.get(url);
    mainPage = require("../pages/mainPage.js");
});

it("Test search response title has requsted text", () => {
    var mainPage = require("../pages/mainPage.js");
    mainPage.search(request);
    expect(mainPage.getResponseTitle().getText()).toContain(request);
});
});

1 个答案:

答案 0 :(得分:0)

首先检查哪个元素失败,然后您可以添加等待元素可见:

 browser.wait(EC.visibilityOf(element(by.id("id"))), 30000, "Element is not visible").