English 中文(简体)
xcode UI 用户界面自动化脚本在 iPhone 上运行精细,但在 iPad 上失败
原标题:xcode UI Automation script runs fine on iPhone but fails on iPad

我在 iPad 的 iPad 上运行脚本时失败 。

example: target.frontMostApp().mainWindow().tableViews()["Empty list"].cells()["Tags:"].buttons()[0].tap();

此行对 iPhone 工作正常, 但 iPad 失败, 错误如下( 标本正试图滚动到可视 - : / ):

target.frontMostApp().mainWindow().tableViews()["Empty list"].cells()["Tags:"].buttons()[0].scrollToVisible() target.frontMostApp().mainWindow().tableViews()["Empty list"].cells()["Tags:"].buttons()[0] could not be tapped Script threw an uncaught JavaScript error: target.frontMostApp().mainWindow().tableViews()["Empty list"].cells()["Tags:"].buttons()[0] could not be tapped

any suggestions? Thanks,

问题回答

您可以使用函数,例如此函数

//function
var _Model=function()
{
 var model=target.model();
 UIALogger.logMessage(model);
 return model;
}
//your main case
if(_Model()=== iPhone Simulator ) 
{
 target.frontMostApp().mainWindow().tableViews()["Empty list"].cells()["Tags:"].buttons()[0].tap();
}
else if(_Model()=== iPad Simulator ) 
{ 
  //here you should write another way to tap Tags: Button
  //you can use record or logtree for getting element ID
} 
else 
{
 UIALogger.logFail("impossible to understand device type");
}




相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签