Is it possible to run a Selenium test in Chromium Browser (not Google Chrome Browser)?
My GoogleDrive location:
My Chromium location:
FYI: I am using Java
My code ( for the moment I am run FirefoxDriver(gecko):
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class MainClass {
public static void main (String[] args){
System.setProperty("webdriver.gecko.driver", "C:\\Users\\User\\IdeaProjects\\testselenium\\drivers\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get ("https://www.seleniumhq.org/");
}
}
I thought that this code would help but without success. Runs Google Chrome, not Chromium:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Chromium {
public static void main (String[] args){
System.setProperty("webdriver.chrome.driver", "C:\\Users\\User\\IdeaProjects\\testselenium\\drivers\\chromedriver.exe");
System.setProperty("webdriver.chrome.binary", "C:\\Users\\User\\Downloads\\chrome-win\\chrome-win\\chrome.exe");
WebDriver driver = new ChromeDriver();
driver.get ("https://www.seleniumhq.org/");
}
}
What could be the problem? How can this question be resolved?
Visit the link: https://chromedriver.chromium.org/downloads. There shall be links available for download for various chromedriver versions. Select the version which is compatible with the Chrome available to our system.
Setup. ChromeDriver is a separate executable that Selenium WebDriver uses to control Chrome. It is maintained by the Chromium team with help from WebDriver contributors.
Selenium and chromium are trace minerals that the body needs to support the growth, development and function of various physiological systems. Selenium aids the thyroid and is a necessary component of enzymes that trigger metabolism and cell regulation. Chromium is required for proper glucose absorption from the blood.
Chromium Browser have different version as follows:
Not sure which Chromium Browser version you are trying to use.
However to use Chrome Canary version you can use the ChromeOptions and setBinary()
method to set the absolute path of the Chrome Canary binary and you can use the following solution:
Code Block:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class A_Chrome_Canary {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\Utility\\BrowserDrivers\\chromedriver.exe");
ChromeOptions opt = new ChromeOptions();
opt.setBinary("C:\\Users\\AtechM_03\\AppData\\Local\\Google\\Chrome SxS\\Application\\chrome.exe");
WebDriver driver = new ChromeDriver(opt);
driver.get("https://www.google.com/");
System.out.println(driver.getTitle());
}
}
Console Output:
Google
Browser Snapshot:
Not clear from your comments but you need to download the latest Chromium binary from either of the official repositories:
With the help of DebanjanB's answer, I developed the following code that can run on Chromium:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class A_Chrome_Canary {
public static void main (String[] args){
System.setProperty("webdriver.chrome.driver", "C:\\Users\\User\\IdeaProjects\\testselenium\\drivers\\chromedriver.exe");
ChromeOptions opt = new ChromeOptions();
opt.setBinary("C:\\Users\\User\\Downloads\\chrome-win\\chrome-win\\chrome.exe");
WebDriver driver = new ChromeDriver(opt);
driver.get("https://www.google.com/");
System.out.println(driver.getTitle());
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With