I am new to protractor and am trying to run the e2e test. I don't know if this is the right thing to do, but ... The page I want to check is not a full angular page, so ... I have problems.
In my first specification, I:
describe('should open contact page', function() { var ptor = protractor.getInstance(); beforeEach(function(){ var Login = require('./util/Login'); new Login(ptor); });
I created this Login class, but after logging in, I want to open the contact page, but the protractor will immediately try to find the item before the page is fully loaded.
I tried to use:
browser.driver.wait(function() { expect(browser.findElement(by.xpath("//a[@href='#/contacts']")).isDisplayed()); ptor.findElement(by.xpath("//a[@href='#/contacts']")).click(); });
But it does not work ... it always tries to find the element before the page loads. I also tried:
browser.driver.wait(function() { expect(ptor.isElementPresent(by.xpath("//a[@href='#/contacts']"))); ptor.findElement(by.xpath("//a[@href='#/contacts']")).click(); });
I can do this with browser.sleep(); but I donβt think this is a good option. Any ideas? In my login class, I have:
ptor.ignoreSynchronization = true;
How can I wait for this @href='#/contacts before the protractor tries to click on it?
javascript angularjs selenium-webdriver automated-tests protractor
Muratso Feb 27 '14 at 15:02 2014-02-27 15:02
source share