Vaitheeswaran
Vaitheeswaran

Reputation: 97

Chrome doesn't open URL automatically

Why did this happen? Chrome opens but the URL does not open with the code.

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
        
public class Id {
    public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver", "E:\\chromedriver\\chromedriver.exe"); //open browser
        WebDriver driver = new ChromeDriver(); 
        **driver.get("google.co.in"); //open URL**
        driver.findElement(By.name("q")).sendKeys("Quadkast" + Keys.ENTER);
    }
}

Upvotes: 3

Views: 305

Answers (1)

YaDav MaNish
YaDav MaNish

Reputation: 1352

You need to give http/https protocol along with the url in the get() method

driver.get("http://www.google.com");
            or
driver.get("https://google.com");

Upvotes: 6

Related Questions