Getting InvalidArgumentException

Krishna Mohan
package trails2110;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Demo01 {
    WebDriver driver;
    
    @Before
    public void setUp() throws Exception {
        System.setProperty("webdriver.chrome.driver", "D:\\Eclipse\\Drivers\\chromedriver.exe");
        System.out.println("1");
        driver= new ChromeDriver();
        System.out.println("2");
    }

    @After
    public void tearDown() throws Exception {
        driver.close();
    }

    @Test
    public void test() {
        String url= "www.hotstar.com";
        System.out.println("3");
        driver.get(url);
        System.out.println("4");
        String Title=driver.getTitle();
        System.out.println(Title);
    }
}

In Console till 3 its getting printed. I have latest version of chrome and latest version of chrome driver for it. i tried with multiple drivers didnt work. am i missing something?

I am able to route to the url with the following code

System.setProperty("webdriver.chrome.driver", "D:\\Eclipse\\Drivers\\chromedriver.exe");
        WebDriver driver= new ChromeDriver();
        String url = "https://www.google.com";
        String script = "window.location = \'"+url+"\'";        
        ((JavascriptExecutor) driver).executeScript(script);

any reasons its not happening with get() method and happening with JavascriptExecutor ?

deokyong song

You should declare the URL with its protocol. So

String url= "www.hotstar.com";
url = "https://" + url

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Installing Braintree and getting error "Uncaught InvalidArgumentException: Dotenv: Environment file .env not found or not readable."

Laravel InvalidArgumentException

PHP Leveral Applications InvalidArgumentException

MongoDB\Exception\InvalidArgumentException

Malformed field path "" (InvalidArgumentException)

Symfony2.0 - InvalidArgumentException

Laravel: Error InvalidArgumentException

InvalidArgumentException - View not found

Laravel: InvalidArgumentException middleware error

InvalidArgumentException Route [login] not defined

InvalidArgumentException JKS not found sheets API

InvalidArgumentException, "View not found", on Lumen 5.2.6

InvalidArgumentException after update to ChromeDriver 78.0.3904.70

Heroku - View Not Found - FileFinderView InvalidArgumentException

Laravel 4.2 InvalidArgumentException View not found

Create Controller using artisan - InvalidArgumentException

packagist complains on new package InvalidArgumentException

installing laravel via composer InvalidArgumentException

Laravel: InvalidArgumentException : Database [mysql] not configured

Problem implementing WebDriverWait with Python - InvalidArgumentException

Microsoft Graph keeps raising InvalidArgumentException

PHPUnit + Selenium `InvalidArgumentException: Element not found`

Selenium scroll_to_element InvalidArgumentException

selenium.common.exceptions.InvalidArgumentException

Selenium throws an InvalidArgumentException when rotating proxy

InvalidArgumentException: Message: invalid argument: 'using' must be a string

how to throw InvalidArgumentException if null value passed to list

Positive integer bigger then 2147483647 still throws InvalidArgumentException

Symfony: InvalidArgumentException while parsing web.xml