简体   繁体   中英

The method getBinaryPath() is undefined for the type WebDriverManager error shows in eclipse while i am trying to run appium automation project

I am trying to run a mini appium project, I have the emulator and an appium server running and here's my code, it says that .getBinaryPath() is undefined for type WebDriverManager "caps.setCapability("chromedriverExecutable", WebDriverManager.chromedriver().getBinaryPath());"

package appiumBasics;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.github.bonigarcia.wdm.WebDriverManager;

@Test
public class RubWebApplicationAndroidEmulator {

    public void OpenWebApplication() throws MalformedURLException {
        DesiredCapabilities caps = new DesiredCapabilities();
    
        caps.setCapability(MobileCapabilityType.BROWSER_NAME, "chrome");
        caps.setCapability(MobileCapabilityType.DEVICE_NAME, "HaidyEmulator");
    WebDriverManager.chromedriver().setup();
    caps.setCapability("chromedriverExecutable", WebDriverManager.chromedriver().getBinaryPath());
        
    AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),caps);
    
    }
}

That is because if you actually go to the repository and open the problematic class, you find there is no such method defined for WebDriverManager :

https://github.com/bonigarcia/webdrivermanager/blob/master/src/main/java/io/github/bonigarcia/wdm/WebDriverManager.java

Presumably this was changed at some point. Possibly you need WebDriverManager#getDownloadedDriverPath() :

@Test
public class RubWebApplicationAndroidEmulator {

    public void OpenWebApplication() throws MalformedURLException {
        DesiredCapabilities caps = new DesiredCapabilities();
    
        caps.setCapability(MobileCapabilityType.BROWSER_NAME, "chrome");
        caps.setCapability(MobileCapabilityType.DEVICE_NAME, "HaidyEmulator");
    WebDriverManager.chromedriver().setup();
    caps.setCapability("chromedriverExecutable", WebDriverManager.chromedriver().getDownloadedDriverPath());
        
    AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),caps);
    
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM