Skip to content Skip to sidebar Skip to footer

Selenium: Managedpromise::32 {[[promisestatus]]: "pending"} Message Shown Before Navigating To The Page

I tried the following selenium-webdriverJS code: var webdriver = require('selenium-webdriver'); var browser = new webdriver.Builder().usingServer().withCapabilities({'browserName':

Solution 1:

You need to extract the value from the promise being returned using then();

All webdriver commands return a promise as part of the promise manager. This enables you to write

driver.findElement(By.css('#searchBar')).clear();
driver.findElement(By.css('#searchBar')).sendKeys('hello');
driver.findElement(By.css('#searchButton')).click();

without having to chain them like this:

driver.findElement(By.css('#searchBar')).clear().then(function() {
  driver.findElement(By.css('#searchBar')).sendKeys('hello').then(function(){
    driver.findElement(By.css('#searchButton')).click();
  });
})

But getAttribute(), like many of the Webdriver JS commands, returns a value. In this case you DO need to register a promise callback to extract that value. So your code becomes:

browser.get('http://localhost:1091/WebTours/sample.html');
var btn = browser.findElement(webdriver.By.id('show-coordinates'));
browser.sleep(3000);
var ids = btn.getAttribute("id").then(function(promiseResult){
  console.log("attribute is: " + promiseResult);
});
browser.quit();

Post a Comment for "Selenium: Managedpromise::32 {[[promisestatus]]: "pending"} Message Shown Before Navigating To The Page"