Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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);
    }
}
like image 433
Vaitheeswaran Avatar asked Apr 28 '26 14:04

Vaitheeswaran


1 Answers

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");
like image 148
YaDav MaNish Avatar answered May 01 '26 02:05

YaDav MaNish