ios - UIImagePickerController 编辑时 : buttons()[2] could not be tapped
<p><p>在 UIImagePickerController 的裁剪屏幕中,我尝试使用 UIAutomation 点击“选择”按钮,但出现此错误:</p>
<blockquote>
<p>target.frontMostApp().mainWindow().buttons() could not be tapped</p>
</blockquote>
<p>我正在使用此代码:</p>
<pre><code>var b = target.frontMostApp().mainWindow().buttons();
if (b.checkIsValid()) {
UIALogger.logPass("b, " + b.isValid() + ", " + b.isEnabled());
b.logElement();
b.tap();
} else {
UIALogger.logFail("!b");
}
</code></pre>
<p>这是输出:</p>
<blockquote>
<p>b, true, 1</p>
<p>UIAButton: name:Choose rect:{{287, 604}, {74, 40}}</p>
<p>target.frontMostApp().mainWindow().buttons().tap()</p>
<p>target.frontMostApp().mainWindow().buttons() could not be tapped</p>
<p>Script threw an uncaught JavaScript error: target.frontMostApp().mainWindow().buttons() could not be tapped on line 13 of New%20Script</p>
</blockquote>
<p>有人知道如何测试吗?感谢您的帮助。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我也遇到了同样的问题,我找到了这个解决方案:</p>
<pre><code>var b = target.frontMostApp().mainWindow().buttons();
var x = b.rect().origin.x + 1;
var y = b.rect().origin.y + 1;
target.tap({x:x, y:y});
</code></pre>
<p>这不是很好,但它工作......</p></p>
<p style="font-size: 20px;">关于ios - UIImagePickerController 编辑时 : buttons() could not be tapped,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/27495649/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/27495649/
</a>
</p>
页:
[1]