{"id":399513,"date":"2024-06-29T14:43:14","date_gmt":"2024-06-29T14:43:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=399513"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=399513","title":{"rendered":"<span>C#: \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f Android \u0431\u0435\u0437 \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u043e\u0432 (adb)<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442<\/h2>\n<p>\u041d\u0435 \u0434\u0430\u0432\u043d\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041c\u043d\u0435 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435 \u0442\u043e \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u0438 \u043f\u043e \u0442\u0438\u043f\u0443 Appium, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0431\u044b\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u044b, \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c 3-4 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430, \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445 \u0441 adb \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0438 \u0442\u0440\u0443\u0434\u043d\u043e, \u0432-\u0442\u0440\u0435\u0442\u044c\u0438\u0445 \u044f \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/quamotion\/madb\" rel=\"noopener noreferrer nofollow\">SharpAdbClient<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u044b\u043b\u0438 \u0443\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u043e \u0441\u0430\u043c\u044b\u0445 \u0432\u0430\u0436\u043d\u044b\u0445 \u043c\u043d\u0435 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u043b\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0445 \u0441\u0430\u043c\u043e\u043c\u0443.\u042f \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c  \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0437\u043e\u0440 \u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/yungd1plomat\/AdvancedSharpAdbClient\" rel=\"noopener noreferrer nofollow\">AdvancedSharpAdbClient<\/a>.<\/p>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h2>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 nuget, \u043b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 package manager:<\/p>\n<pre><code>PM> Install-Package AdvancedSharpAdbClient<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0436\u0435 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/yungd1plomat\/AdvancedSharpAdbClient\" rel=\"noopener noreferrer nofollow\">github<\/a><\/p>\n<h2>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f <a href=\"https:\/\/developer.android.google.cn\/studio\/releases\/platform-tools?hl=en\" rel=\"noopener noreferrer nofollow\">adb.exe<\/a>.\u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 Nox,\u0433\u0434\u0435 adb \u0438\u0434\u0451\u0442 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e \u043f\u0443\u0442\u0438 Nox\\bin\\adb.exe.<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440<\/p>\n<pre><code class=\"cs\">using System; using AdvancedSharpAdbClient;  namespace AdbTest {     class Program     {          static void Main(string[] args)         {             if (!AdbServer.Instance.GetStatus().IsRunning)             {                 AdbServer server = new AdbServer();                 StartServerResult result = server.StartServer(@\"F:\\Nox\\bin\\adb.exe\", false);                 if (result != StartServerResult.Started)                 {                     Console.WriteLine(\"Can't start adb server\");                     return;                 }             }         }     } } <\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0443<\/p>\n<pre><code class=\"cs\">using System; using System.Linq; using AdvancedSharpAdbClient;  namespace AdbTest {     class Program     {         static AdvancedAdbClient client;          static DeviceData device;          static void Main(string[] args)         {             if (!AdbServer.Instance.GetStatus().IsRunning)             {                 AdbServer server = new AdbServer();                 StartServerResult result = server.StartServer(@\"F:\\Nox\\bin\\adb.exe\", false);                 if (result != StartServerResult.Started)                 {                     Console.WriteLine(\"Can't start adb server\");                     return;                 }             }             client = new AdvancedAdbClient();             client.Connect(\"127.0.0.1:62001\"); \/\/ Ip Nox'\u0430             device = client.GetDevices().FirstOrDefault(); \/\/ \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0434\u0435\u0432\u0430\u0439\u0441 \u0438\u0437 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445             if (device == null)             {                 Console.WriteLine(\"Can't connect to device\");                 return;             }         }     } } <\/code><\/pre>\n<p>\u0422\u0443\u0442 \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u0432\u0430\u043c \u043b\u0430\u0439\u0444\u0445\u0430\u043a, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c Ip \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u0432.\u042d\u0442\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430\u043c\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e(\u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c).<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 Nox&#8217;a, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0440\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 620, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<ul>\n<li>\n<p>127.0.0.1:62001<\/p>\n<\/li>\n<li>\n<p>127.0.0.1:62025<\/p>\n<\/li>\n<li>\n<p>127.0.0.1:62040<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u043e\u0439 <strong>netstat<\/strong>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043b\u0443\u0448\u0430\u0435\u0442 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u044b \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 IP \u0434\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">static List&lt;string> deviceports = new List&lt;string>();  static string GetIP() {     while (true)     {         Process[] processes = Process.GetProcessesByName(\"NoxVMHandle\");         foreach (Process process in processes)         {             ProcessStartInfo startInfo = new ProcessStartInfo(\"cmd\", \"\/c netstat -a -n -o | find \\\"\" + process.Id + \"\\\" | find \\\"127.0.0.1\\\" | find \\\"620\\\"\");             startInfo.UseShellExecute = false;             startInfo.CreateNoWindow = true;             startInfo.RedirectStandardOutput = true;              var proc = new Process();             proc.StartInfo = startInfo;             proc.Start();             proc.WaitForExit();              MatchCollection matches = Regex.Matches(proc.StandardOutput.ReadToEnd(), \"(?&lt;=127.0.0.1:)62.*?(?= )\");             foreach (Match match in matches)             {                 if (match.Value != \"\" &amp;&amp; !deviceports.Contains(match.Value))                 {                     deviceports.Add(match.Value);                     return \"127.0.0.1:\" + match.Value;                 }             }         }     } }<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0422\u0430\u043a \u0436\u0435, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u043a\u0435, \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 <strong>AdvancedAdbClient<\/strong> \u0434\u043b\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">static ConcurrentQueue&lt;string> deviceports = new ConcurrentQueue&lt;string>(); \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a  static object locker = new object();  static string GetIP() {     while (true)     {         Process[] processes = Process.GetProcessesByName(\"NoxVMHandle\");         foreach (Process process in processes)         {             ProcessStartInfo startInfo = new ProcessStartInfo(\"cmd\", \"\/c netstat -a -n -o | find \\\"\" + process.Id + \"\\\" | find \\\"127.0.0.1\\\" | find \\\"620\\\"\");             startInfo.UseShellExecute = false;             startInfo.CreateNoWindow = true;             startInfo.RedirectStandardOutput = true;              var proc = new Process();             proc.StartInfo = startInfo;             proc.Start();             proc.WaitForExit();              MatchCollection matches = Regex.Matches(proc.StandardOutput.ReadToEnd(), \"(?&lt;=127.0.0.1:)62.*?(?= )\");             foreach (Match match in matches)             {                 if (match.Value != \"\" &amp;&amp; !deviceports.Contains(match.Value))                 {                     deviceports.Enqueue(match.Value);                     return \"127.0.0.1:\" + match.Value;                 }             }         }     } }  static void Main(string[] args) {     GetIP();     if (!AdbServer.Instance.GetStatus().IsRunning)     {         AdbServer server = new AdbServer();         StartServerResult result = server.StartServer(@\"F:\\Nox\\bin\\adb.exe\", false);         if (result != StartServerResult.Started)         {             Console.WriteLine(\"Can't start adb server\");             return;         }     }     \/\/ \u041f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 Multi Drive 3 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430     for (int i = 0; i &lt; 3; i++) \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0440\u0438 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430     {         new Thread(() =>         {             Process process = new Process();             process.StartInfo.FileName = @\"F:\\Nox\\bin\\Nox.exe\";             process.StartInfo.Arguments = $\"-clone:Nox_{i}\"; \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c i-\u0442\u044b\u0439 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u0438\u0437 Multi-Drive             process.Start();             AdvancedAdbClient client = new AdvancedAdbClient();             lock (locker) \/\/ \u0412\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0438 \u043e\u0448\u0438\u0431\u043e\u043a             {                 client.Connect(GetIP()); \/\/ Ip Nox'\u0430             }             DeviceData device = client.GetDevices().FirstOrDefault();             if (device == null)             {                 Console.WriteLine(\"Can't connect to device\");                 return;             }         }).Start();     } }<\/code><\/pre>\n<\/div>\n<\/details>\n<h2>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<h4>\u041f\u043e\u0438\u0441\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430<\/h4>\n<p>\u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <strong>FindElement<\/strong> \u0438 <strong>FindElements<\/strong><\/p>\n<pre><code class=\"cs\">static AdvancedAdbClient client;  static DeviceData device;  static void Main(string[] args) {     client = new AdvancedAdbClient();     client.Connect(\"127.0.0.1:62001\");     device = client.GetDevices().FirstOrDefault();     Element el = client.FindElement(device, \"\/\/node[@text='Login']\"); }<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0435\u0433\u043e \u043d\u0435\u0442\u0443)<\/p>\n<pre><code class=\"cs\">Element el = client.FindElement(device, \"\/\/node[@text='Login']\", TimeSpan.FromSeconds(5));<\/code><\/pre>\n<pre><code class=\"cs\">Element[] els = client.FindElements(device, \"\/\/node[@resource-id='Login']\", TimeSpan.FromSeconds(5));<\/code><\/pre>\n<h3>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430<\/h3>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0432\u043e\u0438 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u044b, \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043f\u043e\u043b\u044e attributes<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     Element el = client.FindElement(device, \"\/\/node[@resource-id='Login']\", TimeSpan.FromSeconds(3));     string eltext = el.attributes[\"text\"];     string bounds = el.attributes[\"bounds\"];     ... }<\/code><\/pre>\n<h3>\u041a\u043b\u0438\u043a \u043f\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443<\/h3>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     client.Click(device, 600, 600); \/\/ Click on the coordinates (600;600)     ... }<\/code><\/pre>\n<p>\u041b\u0438\u0431\u043e \u0436\u0435 \u043f\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     Element el = client.FindElement(device, \"\/\/node[@text='Login']\", TimeSpan.FromSeconds(3));     el.Click();\/\/ Click on element by xpath \/\/node[@text='Login']     ... }<\/code><\/pre>\n<h3>\u0421\u0432\u0430\u0439\u043f<\/h3>\n<p>AdvancedSharpAdbClient \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0432\u0430\u0439\u043f\u043d\u0443\u0442\u044c \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     Element first = client.FindElement(device, \"\/\/node[@text='Login']\");     Element second = client.FindElement(device, \"\/\/node[@text='Password']\");     client.Swipe(device, first, second, 100); \/\/ Swipe 100 ms     ... }<\/code><\/pre>\n<p>\u0418 \u0442\u0430\u043a \u0436\u0435 \u043f\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     device = client.GetDevices().FirstOrDefault();     client.Swipe(device, 600, 1000, 600, 500, 100); \/\/ Swipe from (600;1000) to (600;500) on 100 ms     ... }<\/code><\/pre>\n<h3>\u0412\u0432\u043e\u0434 \u0442\u0435\u043a\u0441\u0442\u0430<\/h3>\n<p>\u0422\u0435\u043a\u0441\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043b\u044e\u0431\u044b\u043c, \u043d\u043e \u0443\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e adb \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     client.SendText(device, \"text\"); \/\/ \u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432 \u0444\u043e\u043a\u0443\u0441\u0435     ... }<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0444\u043e\u043a\u0443\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 (\u043a\u043b\u0438\u043a\u0430\u0442\u044c, \u0430 \u043f\u043e\u0442\u043e\u043c \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442)<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     client.FindElement(device, \"\/\/node[@resource-id='Login']\").SendText(\"text\"); \/\/ \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0444\u043e\u043a\u0443\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f     ... } <\/code><\/pre>\n<h3>\u041e\u0447\u0438\u0441\u0442\u043a\u0430 \u043f\u043e\u043b\u044f \u0432\u0432\u043e\u0434\u0430<\/h3>\n<p>\u0414\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u043f\u043e\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u043f\u043e\u043b\u0435<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     client.ClearInput(device, 25); \/\/ The second argument is to specify the maximum number of characters to be erased     ... }<\/code><\/pre>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0434\u043b\u0438\u043d\u043d\u0443 \u0442\u0435\u043a\u0441\u0442\u0430 (\u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e)<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     client.FindElement(device, \"\/\/node[@resource-id='Login']\").ClearInput(); \/\/ Get element text attribute and remove text length symbols     ... }<\/code><\/pre>\n<h3>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448\u0438 (keyevent)<\/h3>\n<p>\u0421\u043f\u0438\u0441\u043e\u043a \u044d\u0432\u0435\u043d\u0442\u043e\u0432 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/developer.android.com\/reference\/android\/view\/KeyEvent#constants\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     client.SendKeyEvent(device, \"KEYCODE_TAB\");     ... }<\/code><\/pre>\n<h2>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430<\/h2>\n<p>\u0412\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0435 <a href=\"https:\/\/github.com\/yungd1plomat\/AdvancedSharpAdbClient\" rel=\"noopener noreferrer nofollow\">Github<\/a>, \u0437\u0434\u0435\u0441\u044c \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043b\u0438\u0448\u044c 2 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430.<\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 apk<\/h3>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     PackageManager manager = new PackageManager(client, device);     manager.InstallPackage(@\"C:\\Users\\me\\Documents\\mypackage.apk\", reinstall: false);     manager.UninstallPackage(\"com.android.app\");     ... }<\/code><\/pre>\n<h3>\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/h3>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     client.StartApp(device, \"com.android.app\");     client.StopApp(device, \"com.android.app\"); \/\/ force-stop     ... }<\/code><\/pre>\n<h2>\u0412\u0430\u0436\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h2>\n<p><a href=\"https:\/\/github.com\/yungd1plomat\/AdvancedSharpAdbClient\" rel=\"noopener noreferrer nofollow\">AdvancedSharpAdbClient<\/a> &#8212; \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/p>\n<p><a href=\"https:\/\/github.com\/quamotion\/madb\" rel=\"noopener noreferrer nofollow\">SharpAdbClient<\/a> &#8212; \u0431\u044b\u043b\u0430 \u0432\u0437\u044f\u0442\u0430 \u0437\u0430 \u043e\u0441\u043d\u043e\u0432\u0443, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u043e\u0440\u043a\u043e\u043c madb<\/p>\n<p><a href=\"https:\/\/github.com\/camalot\/madb\" rel=\"noopener noreferrer nofollow\">madb<\/a> &#8212; \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f ddmlib \u0441 Java<\/p>\n<p><a href=\"https:\/\/android.googlesource.com\/platform\/tools\/base\/+\/master\/ddmlib\/\" rel=\"noopener noreferrer nofollow\">ddmlib<\/a> &#8212; \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 adb<\/p>\n<h2>P.S<\/h2>\n<p>\u042f \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0441\u044c \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u0438\u043a\u043e\u043c \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u043e\u0432, \u0442\u0438\u043f\u0430 Appium, \u043f\u0440\u043e\u0441\u0442\u043e \u044d\u0442\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0430 \u043d\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>\u042f \u044f\u0432\u043b\u044f\u044e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0448\u0443 \u0441\u0442\u0440\u043e\u0433\u043e \u043d\u0435 \u0441\u0443\u0434\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u043a\u043e\u0434\u0430<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u043a\u0430\u043a\u0438\u0435 \u043b\u0438\u0431\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043f\u0438\u0448\u0438\u0442\u0435 \u043c\u043d\u0435 \u043d\u0430 <a href=\"https:\/\/mailto:aynur.musin.06@mail.ru\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0447\u0442\u0443<\/a>.<\/p>\n<p>\u042d\u0442\u043e \u043c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 Habr, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0438\u0437\u0432\u0438\u043d\u044f\u044e\u0441\u044c \u0437\u0430 \u043a\u043e\u0441\u044f\u043a\u0438.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/581252\/\"> https:\/\/habr.com\/ru\/articles\/581252\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442<\/h2>\n<p>\u041d\u0435 \u0434\u0430\u0432\u043d\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041c\u043d\u0435 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435 \u0442\u043e \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u0438 \u043f\u043e \u0442\u0438\u043f\u0443 Appium, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0431\u044b\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u044b, \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c 3-4 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430, \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445 \u0441 adb \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0438 \u0442\u0440\u0443\u0434\u043d\u043e, \u0432-\u0442\u0440\u0435\u0442\u044c\u0438\u0445 \u044f \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/quamotion\/madb\" rel=\"noopener noreferrer nofollow\">SharpAdbClient<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u044b\u043b\u0438 \u0443\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u043e \u0441\u0430\u043c\u044b\u0445 \u0432\u0430\u0436\u043d\u044b\u0445 \u043c\u043d\u0435 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u043b\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0445 \u0441\u0430\u043c\u043e\u043c\u0443.\u042f \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c  \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0437\u043e\u0440 \u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/yungd1plomat\/AdvancedSharpAdbClient\" rel=\"noopener noreferrer nofollow\">AdvancedSharpAdbClient<\/a>.<\/p>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h2>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 nuget, \u043b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 package manager:<\/p>\n<pre><code>PM> Install-Package AdvancedSharpAdbClient<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0436\u0435 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/yungd1plomat\/AdvancedSharpAdbClient\" rel=\"noopener noreferrer nofollow\">github<\/a><\/p>\n<h2>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f <a href=\"https:\/\/developer.android.google.cn\/studio\/releases\/platform-tools?hl=en\" rel=\"noopener noreferrer nofollow\">adb.exe<\/a>.\u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 Nox,\u0433\u0434\u0435 adb \u0438\u0434\u0451\u0442 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e \u043f\u0443\u0442\u0438 Nox\\bin\\adb.exe.<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440<\/p>\n<pre><code class=\"cs\">using System; using AdvancedSharpAdbClient;  namespace AdbTest {     class Program     {          static void Main(string[] args)         {             if (!AdbServer.Instance.GetStatus().IsRunning)             {                 AdbServer server = new AdbServer();                 StartServerResult result = server.StartServer(@\"F:\\Nox\\bin\\adb.exe\", false);                 if (result != StartServerResult.Started)                 {                     Console.WriteLine(\"Can't start adb server\");                     return;                 }             }         }     } } <\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0443<\/p>\n<pre><code class=\"cs\">using System; using System.Linq; using AdvancedSharpAdbClient;  namespace AdbTest {     class Program     {         static AdvancedAdbClient client;          static DeviceData device;          static void Main(string[] args)         {             if (!AdbServer.Instance.GetStatus().IsRunning)             {                 AdbServer server = new AdbServer();                 StartServerResult result = server.StartServer(@\"F:\\Nox\\bin\\adb.exe\", false);                 if (result != StartServerResult.Started)                 {                     Console.WriteLine(\"Can't start adb server\");                     return;                 }             }             client = new AdvancedAdbClient();             client.Connect(\"127.0.0.1:62001\"); \/\/ Ip Nox'\u0430             device = client.GetDevices().FirstOrDefault(); \/\/ \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0434\u0435\u0432\u0430\u0439\u0441 \u0438\u0437 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445             if (device == null)             {                 Console.WriteLine(\"Can't connect to device\");                 return;             }         }     } } <\/code><\/pre>\n<p>\u0422\u0443\u0442 \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u0432\u0430\u043c \u043b\u0430\u0439\u0444\u0445\u0430\u043a, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c Ip \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u0432.\u042d\u0442\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430\u043c\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e(\u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c).<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 Nox&#8217;a, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0440\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 620, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<ul>\n<li>\n<p>127.0.0.1:62001<\/p>\n<\/li>\n<li>\n<p>127.0.0.1:62025<\/p>\n<\/li>\n<li>\n<p>127.0.0.1:62040<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u043e\u0439 <strong>netstat<\/strong>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043b\u0443\u0448\u0430\u0435\u0442 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u044b \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 IP \u0434\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">static List&lt;string> deviceports = new List&lt;string>();  static string GetIP() {     while (true)     {         Process[] processes = Process.GetProcessesByName(\"NoxVMHandle\");         foreach (Process process in processes)         {             ProcessStartInfo startInfo = new ProcessStartInfo(\"cmd\", \"\/c netstat -a -n -o | find \\\"\" + process.Id + \"\\\" | find \\\"127.0.0.1\\\" | find \\\"620\\\"\");             startInfo.UseShellExecute = false;             startInfo.CreateNoWindow = true;             startInfo.RedirectStandardOutput = true;              var proc = new Process();             proc.StartInfo = startInfo;             proc.Start();             proc.WaitForExit();              MatchCollection matches = Regex.Matches(proc.StandardOutput.ReadToEnd(), \"(?&lt;=127.0.0.1:)62.*?(?= )\");             foreach (Match match in matches)             {                 if (match.Value != \"\" &amp;&amp; !deviceports.Contains(match.Value))                 {                     deviceports.Add(match.Value);                     return \"127.0.0.1:\" + match.Value;                 }             }         }     } }<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0422\u0430\u043a \u0436\u0435, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u043a\u0435, \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 <strong>AdvancedAdbClient<\/strong> \u0434\u043b\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">static ConcurrentQueue&lt;string> deviceports = new ConcurrentQueue&lt;string>(); \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a  static object locker = new object();  static string GetIP() {     while (true)     {         Process[] processes = Process.GetProcessesByName(\"NoxVMHandle\");         foreach (Process process in processes)         {             ProcessStartInfo startInfo = new ProcessStartInfo(\"cmd\", \"\/c netstat -a -n -o | find \\\"\" + process.Id + \"\\\" | find \\\"127.0.0.1\\\" | find \\\"620\\\"\");             startInfo.UseShellExecute = false;             startInfo.CreateNoWindow = true;             startInfo.RedirectStandardOutput = true;              var proc = new Process();             proc.StartInfo = startInfo;             proc.Start();             proc.WaitForExit();              MatchCollection matches = Regex.Matches(proc.StandardOutput.ReadToEnd(), \"(?&lt;=127.0.0.1:)62.*?(?= )\");             foreach (Match match in matches)             {                 if (match.Value != \"\" &amp;&amp; !deviceports.Contains(match.Value))                 {                     deviceports.Enqueue(match.Value);                     return \"127.0.0.1:\" + match.Value;                 }             }         }     } }  static void Main(string[] args) {     GetIP();     if (!AdbServer.Instance.GetStatus().IsRunning)     {         AdbServer server = new AdbServer();         StartServerResult result = server.StartServer(@\"F:\\Nox\\bin\\adb.exe\", false);         if (result != StartServerResult.Started)         {             Console.WriteLine(\"Can't start adb server\");             return;         }     }     \/\/ \u041f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 Multi Drive 3 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430     for (int i = 0; i &lt; 3; i++) \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0440\u0438 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430     {         new Thread(() =>         {             Process process = new Process();             process.StartInfo.FileName = @\"F:\\Nox\\bin\\Nox.exe\";             process.StartInfo.Arguments = $\"-clone:Nox_{i}\"; \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c i-\u0442\u044b\u0439 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u0438\u0437 Multi-Drive             process.Start();             AdvancedAdbClient client = new AdvancedAdbClient();             lock (locker) \/\/ \u0412\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0438 \u043e\u0448\u0438\u0431\u043e\u043a             {                 client.Connect(GetIP()); \/\/ Ip Nox'\u0430             }             DeviceData device = client.GetDevices().FirstOrDefault();             if (device == null)             {                 Console.WriteLine(\"Can't connect to device\");                 return;             }         }).Start();     } }<\/code><\/pre>\n<\/div>\n<\/details>\n<h2>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<h4>\u041f\u043e\u0438\u0441\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430<\/h4>\n<p>\u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <strong>FindElement<\/strong> \u0438 <strong>FindElements<\/strong><\/p>\n<pre><code class=\"cs\">static AdvancedAdbClient client;  static DeviceData device;  static void Main(string[] args) {     client = new AdvancedAdbClient();     client.Connect(\"127.0.0.1:62001\");     device = client.GetDevices().FirstOrDefault();     Element el = client.FindElement(device, \"\/\/node[@text='Login']\"); }<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0435\u0433\u043e \u043d\u0435\u0442\u0443)<\/p>\n<pre><code class=\"cs\">Element el = client.FindElement(device, \"\/\/node[@text='Login']\", TimeSpan.FromSeconds(5));<\/code><\/pre>\n<pre><code class=\"cs\">Element[] els = client.FindElements(device, \"\/\/node[@resource-id='Login']\", TimeSpan.FromSeconds(5));<\/code><\/pre>\n<h3>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430<\/h3>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0432\u043e\u0438 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u044b, \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043f\u043e\u043b\u044e attributes<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     Element el = client.FindElement(device, \"\/\/node[@resource-id='Login']\", TimeSpan.FromSeconds(3));     string eltext = el.attributes[\"text\"];     string bounds = el.attributes[\"bounds\"];     ... }<\/code><\/pre>\n<h3>\u041a\u043b\u0438\u043a \u043f\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443<\/h3>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     client.Click(device, 600, 600); \/\/ Click on the coordinates (600;600)     ... }<\/code><\/pre>\n<p>\u041b\u0438\u0431\u043e \u0436\u0435 \u043f\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     Element el = client.FindElement(device, \"\/\/node[@text='Login']\", TimeSpan.FromSeconds(3));     el.Click();\/\/ Click on element by xpath \/\/node[@text='Login']     ... }<\/code><\/pre>\n<h3>\u0421\u0432\u0430\u0439\u043f<\/h3>\n<p>AdvancedSharpAdbClient \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0432\u0430\u0439\u043f\u043d\u0443\u0442\u044c \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     Element first = client.FindElement(device, \"\/\/node[@text='Login']\");     Element second = client.FindElement(device, \"\/\/node[@text='Password']\");     client.Swipe(device, first, second, 100); \/\/ Swipe 100 ms     ... }<\/code><\/pre>\n<p>\u0418 \u0442\u0430\u043a \u0436\u0435 \u043f\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     device = client.GetDevices().FirstOrDefault();     client.Swipe(device, 600, 1000, 600, 500, 100); \/\/ Swipe from (600;1000) to (600;500) on 100 ms     ... }<\/code><\/pre>\n<h3>\u0412\u0432\u043e\u0434 \u0442\u0435\u043a\u0441\u0442\u0430<\/h3>\n<p>\u0422\u0435\u043a\u0441\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043b\u044e\u0431\u044b\u043c, \u043d\u043e \u0443\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e adb \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     client.SendText(device, \"text\"); \/\/ \u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432 \u0444\u043e\u043a\u0443\u0441\u0435     ... }<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0444\u043e\u043a\u0443\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 (\u043a\u043b\u0438\u043a\u0430\u0442\u044c, \u0430 \u043f\u043e\u0442\u043e\u043c \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442)<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     client.FindElement(device, \"\/\/node[@resource-id='Login']\").SendText(\"text\"); \/\/ \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0444\u043e\u043a\u0443\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f     ... } <\/code><\/pre>\n<h3>\u041e\u0447\u0438\u0441\u0442\u043a\u0430 \u043f\u043e\u043b\u044f \u0432\u0432\u043e\u0434\u0430<\/h3>\n<p>\u0414\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u043f\u043e\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u043f\u043e\u043b\u0435<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     client.ClearInput(device, 25); \/\/ The second argument is to specify the maximum number of characters to be erased     ... }<\/code><\/pre>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0434\u043b\u0438\u043d\u043d\u0443 \u0442\u0435\u043a\u0441\u0442\u0430 (\u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e)<\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     client.FindElement(device, \"\/\/node[@resource-id='Login']\").ClearInput(); \/\/ Get element text attribute and remove text length symbols     ... }<\/code><\/pre>\n<h3>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448\u0438 (keyevent)<\/h3>\n<p>\u0421\u043f\u0438\u0441\u043e\u043a \u044d\u0432\u0435\u043d\u0442\u043e\u0432 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/developer.android.com\/reference\/android\/view\/KeyEvent#constants\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<pre><code class=\"cs\">static void Main(string[] args) {     ...     client.SendKeyEvent(device, \"KEYCODE_TAB\");     ... }<\/code><\/pre>\n<h2>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430<\/h2>\n<p>\u0412\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0435 <a href=\"https:\/\/github.com\/yungd1plomat\/AdvancedSharpAdbClient\" rel=\"noopener noreferrer nofollow\">Github<\/a>, \u0437\u0434\u0435\u0441\u044c \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043b\u0438\u0448\u044c 2 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430.<\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 apk<\/h3>\n<pre><code class=\"cs\">static void<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-399513","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/399513","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=399513"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/399513\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=399513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=399513"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=399513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}