I wrote an angular project that uses require js, so most javascript will not load until landing on a specific set of pages. (including angular.js)
when writing threads I had to use browser.driver instead of ptor, and this worked until the angular components started up. Now I'm trying to find a way to compress ptor initialization in the browser. driver and roll in angular after a certain thread. So I have something like this
browser.driver.getCurrentUrl().then(function(url){ ptor = protractor.getInstance();
which seems to get ptor undefined after approval, even if I time out. how should i make an exchange here. and make a protractor constructor with a url. without rebooting.
-------------- --------- Addon is ok, that's what I had
searchInput = browser.driver.findElement(by.css('#searchstring')); searchInput.sendKeys('logan airport'); searchInput.sendKeys(protractor.Key.ENTER)//.perform(); browser.driver.sleep(6000); browser.driver.wait(function(){ //angular loads here return browser.driver.getCurrentUrl(function(url){ searchUrl = url; return /screwdriver/.test(url); }); }, 10000) browser.driver.sleep(2000); /*UNEXECUTED CODE HERE: Error while waiting for angular to sync with your page*/ firstItem = element.all(by.css('.itemContainer')).get(1).click(); browser.driver.sleep(10000);
and this is what I'm doing right now ...
searchInput = ptor.findElement(protractor.By.css('#searchstring')); searchInput.sendKeys('logan airport'); searchInput.sendKeys(protractor.Key.ENTER)//.perform(); ptor.sleep(6000); ptor.wait(function(){ //this page loads angular, but stuck on white page, which with previous version this is fluent, it says angular cannot be found on the page return ptor.driver.getCurrentUrl().then(function(url){ searchUrl = url; return /screwdriver/.test(url); }); }, 10000) ptor.sleep(2000); /*NOT EXECUTED: Error while waiting for angular to sync with your page*/ foundItems = ptor.findElement(protractor.By.css('.itemContainer')); firstItem = foundItems.get(1).click(); ptor.sleep(2000);
both do not work, one is angular not synchronized, the other is angular not found, but the actual page will have angular to exist if u hits f12 and enter angular.
source share