我正在尝试使用Calabash运行React-Native应用程序。
我可以成功完成此查询:
query("RCTView marked:' Coaching'")
但是这个不幸的间距有多个观点。我想改为包含查询。
我尝试了一些变体而没有成功,例如:
query("RCTView {label CONTAINS 'Coaching'}")
但这不起作用。
这是第一个查询结果中的视图:
[
[0] {
"alpha" => 1,
"enabled" => true,
"id" => nil,
"visible" => 1,
"frame" => {
"y" => 0,
"x" => 0,
"width" => 75,
"height" => 50
},
"accessibilityElement" => false,
"class" => "RCTView",
"label" => " Coaching",
"description" => "<RCTView: 0x7ff38205a2e0; reactTag: 474; frame = (0 0; 75 50); layer = <CALayer: 0x600000228080>>",
"value" => nil,
"rect" => {
"y" => 617,
"center_x" => 262.5,
"center_y" => 642,
"x" => 225,
"width" => 75,
"height" => 50
}
}
]
答案 0 :(得分:0)
你可以尝试一些事情:
首先,要求开发人员删除间距:)。
如果由于某种原因需要“教练”和“教练”,请使用此:
//Container ------------------------------------
Panel Container = new Panel();
//Top-Docked Element ---------------------------
ButtonArea = new FlowLayoutPanel();
Container.Controls.Add(ButtonArea);
Container.Controls.SetChildIndex(ButtonArea, 1);
ButtonArea.Dock = DockStyle.Top;
//Fill-Docked Element --------------------------
box = new RichTextBox();
Container.Controls.Add(box);
Container.Controls.SetChildIndex(box, 0); //setting this to 0 does the trick
box.Dock = DockStyle.Fill;
在这里,您将浏览哈希并检查标签是否包含您希望包含的内容,在本例中为“Coaching”。
尝试使用'*'代替类名:
query("RCTView")[0]['label'].include? 'Coaching'
如果这对任何标签都不起作用,请考虑以下事项:
query("* { label CONTAINS 'Coaching' }")
希望它有所帮助!