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)
The current URL can be obtained by using the 'URL' property of the Document object which contains information about the current URL. The 'URL' property returns a string with the full location of the current page, along with containing the string having the HTTP protocol such as ( http://).
The window.location.href property returns the URL of the current page.
You can get the current url by doing path_info = request. META. get('PATH_INFO') http_host = request.
driver.get("http://www.google.com")
.then(function() {
return driver.getCurrentUrl();
})
.then(function(currentUrl) {
// work with the current url of browser
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With