WebService

Learn how to use BELLATRIX Android WebService.

Example

[TestClass]
[AndroidWeb(Constants.AndroidNativeAppPath,
    Constants.AndroidDefaultAndroidVersion,
    Constants.AndroidDefaultDeviceName,
    AppBehavior.RestartEveryTime)]
public class WebServiceTests : AndroidTest
{
    [TestMethod]
    public void HtmlSourceContainsShop_When_OpenWebPageWithChrome()
    {
        App.Web.NavigationService.Navigate("http://demos.bellatrix.solutions/");
        Assert.IsTrue(App.Web.BrowserService.HtmlSource.Contains("Shop"));
    }
}

Explanations

BELLATRIX gives you an interface for easier work with web apps. Using it, you can access most of the features of BELLATRIX web APIs.

[TestClass]
[AndroidWeb(Constants.AndroidNativeAppPath,
    Constants.AndroidDefaultAndroidVersion,
    Constants.AndroidDefaultDeviceName,
    AppBehavior.RestartEveryTime)]
public class WebServiceTests : AndroidTest

To test web apps, you can start Chrome browser using the AndroidWeb attribute.

App.Web.NavigationService.Navigate("http://demos.bellatrix.solutions/");

Opens Chrome browser and navigates to the mentioned page.

Assert.IsTrue(App.Web.BrowserService.HtmlSource.Contains("Shop"));

Through Web property you can access almost all BELLATRIX Web APIs.