Question

using the element(by.model()) syntax to find a field and input text.

element(by.model('sample_ad.id')).sendKeys('batman');

gets the exception from chromedriver:

Stacktrace:
     Error: Timed out waiting for Protractor to synchronize with the page after 11 seconds
    at Error (<anonymous>)
==== async task ====
WebDriver.executeScript()
    at Protractor.waitForAngular (/Users/jon/dev/project_name/node_modules/protractor/lib/protractor.js:278:22)
    at Protractor.findElement (/Users/jon/dev/project_name/node_modules/protractor/lib/protractor.js:427:8)
    at Object.elementFinder.(anonymous function) [as sendKeys] (/Users/jon/dev/project_name/node_modules/protractor/lib/protractor.js:62:21)
    at null.<anonymous> (/Users/jon/dev/project_name/test/e2e/features/somedirectiveSpec.js:24:39)
    at /Users/jon/dev/project_name/node_modules/protractor/jasminewd/index.js:54:12
==== async task ====
    at null.<anonymous> (/Users/jon/dev/project_name/node_modules/protractor/jasminewd/index.js:53:12)
    at null.<anonymous> (/Users/jon/dev/project_name/node_modules/protractor/node_modules/minijasminenode/lib/async-callback.js:45:37)
    at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

Not sure why this is breaking, but Protractor seems very fragile right now... I have no issues using the browser object to find elements, input text, etc...

Any help would be appreciated

EDIT: if I change the line to the following, I am able to interact with the text field. browser.driver.findElement(protractor.By.id('sample_ad_id')).sendKeys('batman');

OTHER TIPS

hopefully this will help others....

Found this on github (see references link). The issue I believe is a script not returning, thus the sendKeys didn't work. Before interacting with the dom using protractor objects (element, ptor, etc), set this variable:

browser.ignoreSynchronization = true;

The reason the following works is because it doesn't rely on async calls, its just directly interacts with the dom and inserts the keys into the input field. browser.driver.findElement(protractor.By.id('sample_ad_id')).sendKeys('batman');

The reason my call didn't work (I believe) is because there was an async call that didn't return in time.
element(by.model('sample_ad.id')).sendKeys('batman');

references: https://github.com/angular/protractor/issues/325

It looks like your test is timing out. The default timeout for protractor is 11 seconds.

Try setting a different timeout for this test:

it('should override timeout', function() {
  // Timeout of 30 seconds.
  element(by.model('sample_ad.id')).sendKeys('batman');
}, 30000)

You can also override the timeout for all your tests in the protractor configuration file. See this sample config file:

https://github.com/andresdominguez/protractor-meetup/blob/master/protractor-config.js#L19

// Inside the protractor config file.
onPrepare: function() {
  // Override the timeout for webdriver.
  var ptor = protractor.getInstance();
  ptor.driver.manage().timeouts().setScriptTimeout(60000);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top