package com.codeborne.selenide.webdriver;

import io.github.bonigarcia.wdm.ChromeDriverManager;
import io.github.bonigarcia.wdm.EdgeDriverManager;
import io.github.bonigarcia.wdm.FirefoxDriverManager;
import io.github.bonigarcia.wdm.InternetExplorerDriverManager;
import io.github.bonigarcia.wdm.OperaDriverManager;
import io.github.bonigarcia.wdm.PhantomJsDriverManager;

import static com.codeborne.selenide.WebDriverRunner.isChrome;
import static com.codeborne.selenide.WebDriverRunner.isEdge;
import static com.codeborne.selenide.WebDriverRunner.isFirefox;
import static com.codeborne.selenide.WebDriverRunner.isIE;
import static com.codeborne.selenide.WebDriverRunner.isOpera;
import static com.codeborne.selenide.WebDriverRunner.isPhantomjs;
import static org.apache.commons.lang3.StringUtils.isNotBlank;

public class WebDriverBinaryManager {
  public void setupBinaryPath() {
    if (isChrome() && !isSystemPropertySet("webdriver.chrome.driver")) {
      ChromeDriverManager.getInstance().setup();
    } else if (isEdge() && !isSystemPropertySet("webdriver.edge.driver")) {
      EdgeDriverManager.getInstance().setup();
    } else if (isIE() && !isSystemPropertySet("webdriver.ie.driver")) {
      InternetExplorerDriverManager.getInstance().setup();
    } else if (isOpera() && !isSystemPropertySet("webdriver.opera.driver")) {
      OperaDriverManager.getInstance().setup();
    } else if (isPhantomjs() && !isSystemPropertySet("phantomjs.binary.path")) {
      PhantomJsDriverManager.getInstance().setup();
    } else if (isFirefox() && !isSystemPropertySet("webdriver.gecko.driver")) {
      FirefoxDriverManager.getInstance().setup();
    }
  }

  private boolean isSystemPropertySet(String key) {
    return isNotBlank(System.getProperty(key, ""));
  }
}

@@ -72,290 +72,11 @@
 wdm.
-ChromeDriverManager;%0Aimport io.github.bonigarcia.wdm.EdgeDriverManager;%0Aimport io.github.bonigarcia.wdm.FirefoxDriverManager;%0Aimport io.github.bonigarcia.wdm.InternetExplorerDriverManager;%0Aimport io.github.bonigarcia.wdm.OperaDriverManager;%0Aimport io.github.bonigarcia.wdm.PhantomJs
+Web
 Driv
@@ -677,22 +677,19 @@
 %7B%0A      
-Chrome
+Web
 DriverMa
@@ -690,35 +690,36 @@
 iverManager.
-getInstance
+chromedriver
 ().setup();%0A
@@ -800,20 +800,19 @@
 %7B%0A      
-Edge
+Web
 DriverMa
@@ -813,35 +813,34 @@
 iverManager.
-getInstance
+edgedriver
 ().setup();%0A
@@ -921,24 +921,11 @@
     
-InternetExplorer
+Web
 Driv
@@ -930,35 +930,32 @@
 iverManager.
-getInstance
+iedriver
 ().setup();%0A
@@ -1038,21 +1038,19 @@
 %7B%0A      
-Opera
+Web
 DriverMa
@@ -1051,35 +1051,35 @@
 iverManager.
-getInstance
+operadriver
 ().setup();%0A
@@ -1169,17 +1169,11 @@
     
-PhantomJs
+Web
 Driv
@@ -1178,35 +1178,33 @@
 iverManager.
-getInstance
+phantomjs
 ().setup();%0A
@@ -1289,23 +1289,19 @@
 %7B%0A      
-Firefox
+Web
 DriverMa
@@ -1310,19 +1310,21 @@
 ger.
-getInstance
+firefoxdriver
 ().s

Migrate from old webdrivermanager api to new one. (#722)