Hithesh
Hithesh

Reputation: 11

Not able to initiate the Andrioddriver

As i am new to Appium while writing the simple test script i am not able to initiate the Android Driver and getting the error as:

"The constructor AndroidDriver(DocFlavor.URL, DesiredCapabilities) is undefined"

please help on this.

public class test {

    @Test
    public void test1()
    {
        DesiredCapabilities capabilities = DesiredCapabilities.android();

        capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, BrowserType.CHROME);

        //capabilities.setCapability(MobileCapabilityType.PLATFORM, Platform.ANDROID);

        //capabilities.setCapability(MobileCapabilityType.PLATFORM, Platform.ANDROID);

        capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "ANDROID");

        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "3618ca1");    

        capabilities.setCapability(MobileCapabilityType.VERSION, "8.0.0");

        URL url = new URL("http://0.0.0.0:4723/wd/hub");

        RemoteWebDriver driver =new AndroidDriver(url, capabilities);
    }
}  

Upvotes: 1

Views: 95

Answers (1)

Padma
Padma

Reputation: 117

Can u try the above code under @Before instead of @Test since the code in @Before will run before the execution of tests so that the android driver will get initialised.

Upvotes: 1

Related Questions