Have problem under beforeEach function in my test class. Click on the usersTab sometimes works fine, and sometimes returns StaleElementReferenceException
. Have tried protractor.ExpectedConditions
like presenceOf
or visibilityOf
or elementToBeClickable
but none worked in 100%. I think that is caused by asynchronous and sometimes browser firstly want to click and afterwards wait - is it possible ?
Any idea how to handle it ?
var OnePage = require('../pages/one_page.js');
var SecondPage = require('../pages/second_page.js');
describe('Test', function () {
var onePage;
var secondPage;
var EC = protractor.ExpectedConditions;
beforeEach(function () {
browser.ignoreSynchronization = true;
onePage = new OnePage();
browser.wait(EC.presenceOf(onaPage.userLogin), 5000);
onePage.setUser('login@login');
onePage.setPassword('password');
onePage.login();
secondPage = new SecondPage();
browser.wait(EC.visibilityOf(secondPage.usersTab), 10000);
usersPage.usersTab.click();
});
Aucun commentaire:
Enregistrer un commentaire