0

I'm running some of my Appium test cases which are written in c# under .net platform on a real time device which is attached to my workstation.
Below is my code and it works fine.

  public void AppiumSetupMethod()
        {

            string appPath = @"G:\Projects\UGL\DTZMobility\Mobility.client\release\android\dev-2.1_.apk";
            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.SetCapability(CapabilityType.BrowserName, "");
            capabilities.SetCapability(CapabilityType.Platform, "Android");
           capabilities.SetCapability(CapabilityType.Version, "4.1.0");
            capabilities.SetCapability(CapabilityType.IsJavaScriptEnabled, "true");

            capabilities.SetCapability("deviceName", "CB5A1THVTT");

            capabilities.SetCapability("appActivity", "com.XXX.XXX.XXX");

            capabilities.SetCapability("Version", "4.1.0");
            capabilities.SetCapability("platformName", "Android");
            capabilities.SetCapability("autoWebview", "true");
            capabilities.SetCapability("sessionOverride", "true");
            capabilities.SetCapability("app", appPath);
            capabilities.SetCapability("appPackage", "com.XX.XX");

            capabilities.SetCapability("newCommandTimeout", "0");
            capabilities.SetCapability("recreateChromeDriverSessions", "true");


            driver = new AndroidDriver <IWebElement> (new Uri("http://127.0.0.1:4723/wd/hub"), capabilities,TimeSpan.FromSeconds(180));
            Thread.Sleep(15000);
        }

But how should i run the same test on a kobiton device. According to kobiton's documentation i have did some initial setup, as below, But i don't know how to add the kobitonServerUrl.

public void kobitonSetupMethod()
    {
        String kobitonServerUrl = "https://chathudagr8:2d9c748a-b5c9-4714-8372-a7fe9393b10d@api.kobiton.com/wd/hub";
        string appPath = @"G:\Projects\UGL\DTZMobility\Mobility.client\release\android\dev-2.1_.apk";

        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.SetCapability("sessionName", "Automation test session");
        capabilities.SetCapability("sessionDescription", "");
        capabilities.SetCapability("deviceOrientation", "portrait");
        capabilities.SetCapability("captureScreenshots", true);
        // The maximum size of application is 500MB
        // By default, HTTP requests from testing library are expired
        // in 2 minutes while the app copying and installation may
        // take up-to 30 minutes. Therefore, you need to extend the HTTP
        // request timeout duration in your testing library so that
        // it doesn't interrupt while the device is being initialized.
        capabilities.SetCapability("app",appPath);
        capabilities.SetCapability("deviceGroup", "KOBITON");
        capabilities.SetCapability("deviceName", "Galaxy On Nxt");
        capabilities.SetCapability("platformVersion", "6.0.1");
        capabilities.SetCapability("platformName", "Android");




        capabilities.SetCapability(CapabilityType.IsJavaScriptEnabled, "true");
        capabilities.SetCapability("appActivity", "com.XX.XX.XXX");
        capabilities.SetCapability("autoWebview", "true");
        capabilities.SetCapability("sessionOverride", "true");
        capabilities.SetCapability("appPackage", "com.XXX.XXX");
        //capabilities.SetCapability("appPackage", "com.dtz");
        capabilities.SetCapability("newCommandTimeout", "0");
        capabilities.SetCapability("recreateChromeDriverSessions", "true");
        driver = new AndroidDriver<IWebElement>(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities, TimeSpan.FromSeconds(180));
        Thread.Sleep(15000);
    }
0

Replace kobitonServerUrl the with http://127.0.0.1:4723/wd/hub solved the problem.

  • Is your problem gets resolved with this? – Bharat Mane Feb 26 '18 at 10:31
  • Yes. But now there is another issue. Im investigating on it. – ChathuD Feb 26 '18 at 11:10
  • Please credit Bharat's answer if it was correct – Amias Feb 26 '18 at 20:05
  • 1
    @amias why would i credit Bharat? – ChathuD Feb 27 '18 at 4:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.