javascript - 如何在 iOS 自动化中访问 UITableView 内的单元格
<p><p>我需要帮助访问 UITableView 中的单元格(名称:设置)。我在 ipad v6.0.1 上做 ios-UIAutomation。</p>
<p>我尝试了所有这些命令 - </p>
<ol>
<li><code>mainWindow.popover().tableViews().cells().tap();</code></li>
<li><code>mainWindow.tableViews().cells()["设置"].tap();</code></li>
<li><code>mainWindow.popover().tableViews().cells().elements()["设置"];</code></li>
</ol>
<p>但没有任何效果。</p>
<p>logElementTree 看起来像这样 - </p>
<pre><code>UIATarget
| UIAApplication
| UIAWindow
| UIAPopover
| UIATableView : name:Empty list
| UIATableCell : name:Menu
| **UIATableCell : name:Settings**
</code></pre>
<p>附上logTree截图供引用。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>首先,我建议为表格 View 本身添加一个名称。使用数组偏移量会使您的测试代码更难维护。为顶级项目定义变量是“标准”做法。</p>
<p>我相信这段代码会起作用。在 Instruments 中的 JavaScript“框架”内工作是一种令人沮丧的练习。我发现命名中间对象是一个很好的起点。</p>
<pre><code>var target = UIATarget.localTarget();
var app = target.frontMostApp();
var mainWindow = app.mainWindow();
var targetTableView = mainWindow.popover.tableViews();
targetTableView().cells()["Settings"].tap()
</code></pre></p>
<p style="font-size: 20px;">关于javascript - 如何在 iOS 自动化中访问 UITableView 内的单元格,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/17610340/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/17610340/
</a>
</p>
页:
[1]