本文介绍了轻松安全的 AppiumService的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Appium 的新手,我想使用 appium 和 C# 执行一些 ADB 命令,执行adb shell ps"的示例

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);

我以编程方式启动 appium

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();

因此引发了一个异常,它说以宽松的安全性运行 appium.我尝试使用此appium --relaxed-security"通过命令行运行 appium 并且它有效.我试着检查这个 link
我想我需要添加一个论点,但我不知道是哪一个.

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.);

那么如何以宽松的安全性启动 appium?

So how to start appium with relaxed security?

推荐答案

经过深挖,我发现这个 feautre 无法在 appium 上以编程方式运行.所以我像这样在命令行中运行 appium appium --relaxed-security由此,我可以使用 appium 运行 adb 命令.

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

这篇关于轻松安全的 AppiumService的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 01:26