Prerequisites

Firstly, you need to download the Chromium browser. Once downloaded, you can copy and paste the local path of chrome.exe in script file. It is highly recommended that before you start the execution, check the compatibility of chromedriver with the Chromium browser version. If not, then download the compatible version of the driver and browser accordingly.

How to launch the Chromium browser using Selenium Java
KW.java
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

class KW 
{
    public static void main(String[] args) 
    {
        System.setProperty("webdriver.chrome.driver", "/home/kodingwindow/drivers/chromedriver");
        ChromeOptions co = new ChromeOptions();
        co.setBinary("D:\\Selenium\\chrome-win\\chrome.exe");
        WebDriver driver = new ChromeDriver(co);
        driver.manage().window().maximize();
        
        driver.navigate().to("https://kodingwindow.com/testapp/");
        driver.findElement(By.name("username")).sendKeys("kodingwindow");
        driver.findElement(By.name("password")).sendKeys("kodingwindow");
        driver.findElement(By.name("login")).click();
        driver.close();
    }   	
}
Advertisement