0

This is my URL in object repository file

URL = https://www.google.co.in/

And this is my code

WebDriver driver = new FirefoxDriver();
 driver.get("URL");

Getting error - Exception in thread "main" org.openqa.selenium.WebDriverException: Target URL URL is not well-formed. Command duration or timeout: 43 milliseconds

  • What is your object repository? How is it organized? How do you get items from it? – Alexey R. Feb 3 '18 at 20:23
  • what type of file are you using for a object repository is it .txt, .properties, .yml , .yaml, etc.... – Alok Feb 5 '18 at 7:29
3

Selenium's driver.get method expects the argument to be a URL, not a string. What you've entered is a string which is why the error has occured.

Try

driver.get(URL);

or simply

driver.get("https://www.google.com");
  • Technically, the parameter to driver.get() is a string . . . it's just a matter of passing in the right string . . . . – ernie Feb 4 '18 at 3:28
  • He is trying to get the url that is stored on the object repository file. since he is trying to read a value from a file. I don't think he can directly call the url variable. – Alok Feb 5 '18 at 12:44
0

In repository...URL is already defined as String...so just use URL without quote...e.g.

WebDriver driver = new FirefoxDriver();
driver.get(URL);

If error didn't resolve through this...try

WebDriver driver = new FirefoxDriver();
System.out.print(URL);
//driver.get(URL);

Verify whether URL contains the proper url which you have defined in object repository. Hoping this should resolve your issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.