Test HYBRID app with appium via visual studio with C#

Hi.
I’m testing Hybrid app using: Appium and C# by visual studio.
I know that I need to change the context in order to use the WEBVIEW.

This is the available context I have:
info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.

This is my C# code:
[TestMethod]
public void TestMethod1()
{
DesiredCapabilities cap = new DesiredCapabilities();
cap.SetCapability(“platformName”, “Android”);
cap.SetCapability(“platformVersion”, “6.0”);
cap.SetCapability(“deviceName”, “test”);
cap.SetCapability(“appPackage”, );
cap.SetCapability(“appActivity”, );

        driver = new AndroidDriver<AndroidElement>(new Uri("http://127.0.0.1:4723/wd/hub"), cap);

        driver.Context = "WEBVIEW_com.<MYAPPPNAME>";
        driver.FindElementById("login").SendKeys("Jack");
    }

While debuging I can see this error below when trying to set the driver.context:
"
An exception of type ‘OpenQA.Selenium.WebDriverException’ occurred in appium-dotnet-driver.dll but was not handled in user code

Additional information: The HTTP request to the remote WebDriver server for URL http://127.0.0.1:4723/wd/hub/session/7b2abc3f-a6c2-47c2-bf83-136b052a2572/context timed out after 60 seconds.
"

What I’m missing here?

Thanks!

Checkout http://appium.readthedocs.io/en/stable/en/writing-running-appium/appium-bindings/.

It is a great reference for your language specific syntax.

I believe that code you need would be something like:
driver.SetContext(“WEBVIEW_COM”);

I don’t believe you need to provide the .MYAPPNAME that you have in your original code, but as my appium tests are written in Ruby, I’m not 100% sure.

Also, make sure that your webview is fully loaded before attempting to interact with your login field.

Good luck and hope that helps!