Versions used while doing this blog post, (These are the prerequisites to automate the New Microsoft Edge browser developed based on Chromium. Browser and driver versions should match)
selenium-java version – 3.141.59
edge browser version – 80.0.361.109 (Official build) (64-bit)
edge driver version – 80.0.361.109 (Download link : https://msedgewebdriverstorage.z22.web.core.windows.net/?prefix=80.0.361.109/)
Microsoft have launched their new Microsoft Edge browser based on Chromium by the start of this year. This browser is light weight and faster than the previous version.
You can download and update the new version using the below link,
https://support.microsoft.com/en-in/help/4501095/download-the-new-microsoft-edge-based-on-chromium
Edge drivers can be downloaded from below link,
https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Edge chromium browser can be opened using selenium by following below steps:
1. Map the path of the downloaded msedgedriver.exe file to ‘webdriver.edge.driver’,
System.setProperty("webdriver.edge.driver",System.getProperty("user.dir")+"\\src\\main\\resources\\msedgedriver.exe");
2. Instantiate (creation of object) driver object with EdgeDriver() class (This step opens the edge chromium browser)
WebDriver driver = new EdgeDriver();
3. Now, next steps of maximizing the browser, setting implicit timeout for driver object and launch of expected website can be carried out
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.get("https://www.google.com");
4. Quit/close the driver object after automating the necessary flows within the website.
Sample code for reference
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;
import java.util.concurrent.TimeUnit;
public class LaunchEdgeTest {
public static void main(String[] args){
System.setProperty("webdriver.edge.driver",System.getProperty("user.dir")+"\\src\\main\\resources\\msedgedriver.exe");
WebDriver driver = new EdgeDriver();
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.get("https://www.google.com");
driver.findElement(By.name("q")).sendKeys("Test");
driver.quit();
}
}