Add Custom Appium Options

Learn how to add custom Appium options.

Example

[TestClass]
[Android(Constants.AndroidNativeAppPath,
    Constants.AndroidDefaultAndroidVersion,
    Constants.AndroidDefaultDeviceName,
    Constants.AndroidNativeAppAppExamplePackage,
    ".view.Controls1",
    AppBehavior.ReuseIfStarted)]
public class CustomWebDriverCapabilitiesTests : AndroidTest
{
    public override void TestsArrange()
    {
        App.AddAppiumCapability("locale", "fr_CA");
        App.AddAppiumCapability("language", "fr");
        App.AddAppiumCapability("autoWebview", "true");
        App.AddAppiumCapability("noReset", "false");
    }

    [TestMethod]
    public void ButtonClicked_When_CallClickMethod()
    {
        var button = App.ElementCreateService.CreateByIdContaining<Button>("button");

        button.Click();
    }

    [TestMethod]
    public void ButtonClicked_When_CallClickMethodSecond()
    {
        var button = App.ElementCreateService.CreateByIdContaining<Button>("button");

        button.Click();
    }
}

Explanations

App.AddAppiumCapability("locale", "fr_CA");
App.AddAppiumCapability("language", "fr");
App.AddAppiumCapability("autoWebview", "true");
App.AddAppiumCapability("noReset", "false");

BELLATRIX hides the complexity of initialisation of WebDriver/Appium and all related services. In some cases, you need to customise the set up of a Appium with using custom Appium options. Using the App service methods you can add all of these with ease. Make sure to call them in the TestsArrange which is called before the execution of the tests placed in the test class. These options are used only for the tests in this particular class. Note: You can use all of these methods no matter which attributes you use- Android, AndroidSauceLabs, AndroidBrowserStack or AndroidCrossBrowserTesting.