Seeking guidance as a newbie in the world of Protractor, I am currently attempting to implement an end-to-end test. However, facing some challenges as the page I wish to test is not entirely Angular-based. My initial spec looks like this:
describe('should open contact page', function() {
var ptor = protractor.getInstance();
beforeEach(function(){
var Login = require('./util/Login');
new Login(ptor);
});
In my quest to navigate to the contact page post-login, Protractor persistently attempts to find elements before the page is fully loaded.
I have tried utilizing the following code snippet:
browser.driver.wait(function() {
expect(browser.findElement(by.xpath("//a[@href='#/contacts']")).isDisplayed());
ptor.findElement(by.xpath("//a[@href='#/contacts']")).click();
});
Regrettably, this approach has been unsuccessful, with Protractor consistently attempting to locate elements prior to page completion. Another attempt made was:
browser.driver.wait(function() {
expect(ptor.isElementPresent(by.xpath("//a[@href='#/contacts']")));
ptor.findElement(by.xpath("//a[@href='#/contacts']")).click();
});
While resorting to browser.sleep();
does get the job done, I acknowledge it may not be the most efficient solution. In my login class, the following line is present:
ptor.ignoreSynchronization = true;
Is there a way to pause and wait for @href='#/contacts'
before Protractor attempts to perform a click action?