node.jsseleniumselenium-webdriverwebdriver

Get current URL of browser


In Selenium Nodejs, How can I get the current url of the page I'm testing (the moment my test script is running assume that the page initially has been redirected)


Solution

  • driver.get("http://www.google.com")
        .then(function() {
            return driver.getCurrentUrl();
        })
        .then(function(currentUrl) {
            // work with the current url of browser
        });