Search code examples
c#appiumappium-android

relaxed Security AppiumService


I am new to Appium, and I want to execute some ADB commands using appium with C#, example to execute "adb shell ps"

Dictionary<string, object> map = new Dictionary<string, object>();
map.Add("command", "ps");
var output = driverAndroid.ExecuteScript("mobile: shell", map);

And I start appium programatically

AppiumLocalService service;
AppiumServiceBuilder builder;
if (service == null)
{
   builder = new 
   AppiumServiceBuilder().WithLogFile(new System.IO.FileInfo("Log"));
   service = builder.Build();
}

if (!service.IsRunning)
{
   service.Start();
}
service.Start();

So an exception raised and it says to run appium with relaxed Security. I try running appium by command line with this "appium --relaxed-security" and it works. I try to check this link
I think I need to add an argument but I don't know which one.

OptionCollector args = new OptionCollector().AddArguments(GeneralOptionList.);

So how to start appium with relaxed security?


Solution

  • After digging, I find that this feautre can't run programatically on appium. So I run appium in command line like this appium --relaxed-security and from that, I can run adb commands using appium.