3

I'm learning about Selenium webdriver test using Java to test my application.

I'm already implemented my tests to Google Chrome and Firefox, but the msedgedriver.exe is not opening the edge browser.

I'd like some help!

public WebDriver getDriver() {
    return driver;

}

@BeforeAll
/*--- INICIALIZAÇÃO DO OGFIN*/

public void abrirOgfin() throws Exception {
    String link;
    int x=2;

    switch(x) {
        case 1:
            System.setProperty("webdriver.gecko.driver", "C:\\workspace\\conf\\firefox\\geckodriver.exe");
            driver = new FirefoxDriver();
            //link = "http://sistema.ogfin.com.br/ogfin/Login";     //Servidor
            link = "http://192.168.1.46:8888/ogfin/Login";         //Local
            break;
        case 2:
            System.setProperty("webdriver.edge.driver", "C:\\workspace\\conf\\edge\\msedgedriver.exe");
            driver = new EdgeDriver();
            //link = "http://sistema.ogfin.com.br/ogfin/Login";     //Servidor
            link = "http://192.168.1.46:8888/ogfin/Login";         //Local
            break;
        default:
            System.setProperty("webdriver.chrome.driver", "C:\\workspace\\conf\\chromedriver.exe");
            driver = new ChromeDriver();
            link = "http://sistema.ogfin.com.br/ogfin/Login";     //Servidor
            //link = "http://192.168.1.46:8888/ogfin/Login";     //Local
    }

    driver.manage().window().maximize();
    driver.get(link);
}

When I run the code, the console show:

Starting MSEdgeDriver 75.0.139.20 (02d0ed4079b152f381df65e7da8a795530021fb1) on port 9579
Only local connections are allowed.
Please protect ports used by the WebDriver and related test frameworks to prevent access by malicious code.
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Looks like you are making test with new MS Edge (Chromium). you can try to refer this thread may help you to get the idea about how to run it. Ref: https://stackoverflow.com/questions/56076421/selenium-and-edge-dev-chromium-based/56134530#56134530 – Deepak-MSFT Jul 05 '19 at 14:47
  • You can try to change new EdgeDriver() to new ChromeDriver(). New Edge web driver can only be work when initialized as a chrome driver. So you can try to replace it and again try to make a test. let us know about your testing result. We will try to provide further suggestions if issue persists.Thanks for your understanding. – Deepak-MSFT Aug 13 '19 at 06:48
  • https://stackoverflow.com/questions/56076421/selenium-and-edge-dev-chromium-based/56134530#56134530 This worked for me. – Archana Deshpande Jan 10 '20 at 06:28

1 Answers1

0

import org.openqa.selenium.WebDriver; import org.openqa.selenium.edge.EdgeDriver;

public class Pr22072023 {

public static void main(String[] args){

    System.setProperty("webdriver.edge.driver", "D:\\Qtree Tech\\Selenium\\Driver\\msedgedriver.exe");
    WebDriver driver = new EdgeDriver();

    driver.get("https://www.google.co.in/");

    driver.close();
}

}

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – LinFelix Jul 26 '23 at 09:23