0
votes

When I was try to send keys in non-angular page with protractor it shows an error "NoSuchElementError: no such element"

NoSuchElementError: no such element (Session info: chrome=47.0.2526.80) (Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 24 milliseconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50' System info: host: 'Sekhar-PC', ip: '192.168.1.3', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_13' * Element info: {Using=id, value=ius-userids} Session ID: 352e36f285f80dee03eb5c88697ebc08 Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=C:\Users\Sekhar\AppData\Local\Temp\scoped_dir3128_18281}, rotatable=false, locationContextEnabled=true, mobileEmulationEnabled=false, version=47.0.2526.80, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, applicationCacheEnabled=false, takesScreenshot=true}] **

3
Need to see both your spec and the config file to help.Gunderson

3 Answers

0
votes

When testing non-Angular pages with Protractor, you need to include this line in all of your specs:

browser.ignoreSynchronization = true;

You also need to wait for the page to completely load. Using ExpectedConditions is one way to do that. Example:

var EC = protractor.ExpectedConditions;
browser.wait(EC.elementToBeClickable(element(by.css('.wait-for-me'))), 10000);
0
votes

Use sleep condition.

browser.driver.sleep(500);

This will wait the browser for sometime.

0
votes

Looks like timing issue, write some "expect" statements so that it will verify for particular functionality is available.
Try to use implicit wait. Try writing your script in promises so that it will wait.

field.sendKeys(value).then(function(){
  submitButton.click().then(function(){
      expect('xyz').toBe(xyz);
   });
});