Monday, 20 June 2016

Launching Microsoft Edge Browser using Selenium

We can launch the Microsoft Edge Browser using below code. Note that you will have to download the Microsoft Edge driver from the link -  https://www.microsoft.com/en-us/download/details.aspx?id=48740 and set the property - webdriver.edge.driver in code. Also make sure that you are aware of IE settings required for Selenium.


package msedgetests;

import org.junit.Test;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

import java.util.concurrent.TimeUnit;

/**
 * Created by Sagar on 19-02-2016.
 */
public class LaunchEdge {

    @Test
    public void launchEdgeBrowser() throws Exception{
        WebDriver driver = null;

       System.setProperty("webdriver.edge.driver",
        "C:\\Program Files (x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe");

        driver = new EdgeDriver();
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        driver.manage().window().maximize();
        String domain = "http://www.softpost.org";
        driver.get(domain);
        System.out.println(driver.getTitle());
        driver.close();
        driver.quit();
    }
}


What do you think on above selenium topic. Please provide your inputs and comments. You can write to me at reply2sagar@gmail.com

No comments:

Post a Comment

Buy Best Selenium Books

Contributors