rajana sekhar
rajana sekhar

Reputation: 511

protractor NoSuchElementError: no such element

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}] **

Upvotes: 0

Views: 3239

Answers (3)

Nick
Nick

Reputation: 504

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);
   });
});

Upvotes: 0

TesterABC
TesterABC

Reputation: 1226

Use sleep condition.

browser.driver.sleep(500);

This will wait the browser for sometime.

Upvotes: 0

chinaowl
chinaowl

Reputation: 532

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);

Upvotes: 0

Related Questions