Saturday, 28 September 2013

Nodejs using selenium-webdriver library with phantomjs as driver, attempting to return current URL

Nodejs using selenium-webdriver library with phantomjs as driver,
attempting to return current URL

var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.phantomjs()).
build();
driver.get('http://www.duckduckgo.com');
driver.findElement(webdriver.By.id('search_form_input_homepage')).sendKeys('webdriver
books and stuff');
driver.findElement(webdriver.By.id('search_button_homepage')).click();
//this is the part I am having trouble with...
setTimeout(function() {
console.log(driver.getCurrentUrl());
}, 5000);
This all works as expected up to the setTimeout(), and for this example (I
have tried many options), I get...
{ then: [Function: then],
cancel: [Function: cancel],
isPending: [Function: isPending] }

No comments:

Post a Comment