java - Webdriver throwing "Cannot navigate to invalid URL" error -


webdriver able navigate base url unable perform actions in clicking link or getting page title. the:

driver.getcurrenturl()  

is throwing:

unhandled inspector error: {"code":-32603,"message":"cannot navigate invalid url"

not sure how fix it.

can check if have prepended http in url. think solve issue in case did not use it.

change navigate part as:

driver.navigate().to("http://www.example.com"); 

in second ex too, use following:

driver.navigate().to("http://www.url.com/");     driver.findelement(by.linktext("login").click();  

complete source code:

import org.openqa.selenium.by; import org.openqa.selenium.webdriver; import org.openqa.selenium.chrome.chromedriver; import org.openqa.selenium.safari.safaridriver;  public class checkwebdriver {   private final webdriver driver = new safaridriver();      void checklogin(){     string baseurl = "http://newtours.demoaut.com/";      driver.get(baseurl);     system.out.println(driver.getcurrenturl());      driver.findelement(by.linktext("register")).click();   }     public static void main(string[] args) {       checkwebdriver web = new checkwebdriver();       web.checklogin();   }  } 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -