javascript - Handle Non-Angular pages in Protractor -
i have application navigates away non-angular app login. basic login this. first, loads angular app, click on button on page. navigates away non angular app (sts implemented identityserver) , logs in, navigates angular app.
here code wrote handle this.
this.login = function (userid) { browser.driver.get(browser.params.host.hostname); browser.driver.findelement(by.id('continuebutton')).click(); browser.driver.wait(function () { browser.driver.findelement(by.xpath("//*[@id=\"body\"]/section/div[2]/div[3]/a")).click(); browser.driver.findelement(by.id("username")).sendkeys(userid); browser.driver.findelement(by.id("password")).sendkeys("flisdev"); browser.driver.findelement(by.tagname("button")).click(); }, 10000); };
but throws 'angular not found on page" error , randomly element not found error link referenced xpath. basic flow of login
angular app --> non-angualr app --> angular app
how can handle kind of login?
whenever shift non-angular app, use
browser.ignoresynchronization = true
code in beforeall()
or beforeeach()
functions, protractor gets know shouldn't check angular on page , not wait angular settle down. if still doesn't fix issue, try giving browser.ignoresynchronization = false
in angular app along above line. along best practice wait element appear before performing actions on avoid errors related element presence. hope helps.
Comments
Post a Comment