- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试验证最初禁用 continueButton.isEnabled = false
的 UIButton 是否存在。
当我在 calabash-ios console
中检查树时,我得到以下结果
[UIWindow]
[UIView]
[UIView]
[MyProject.GradientView]
[UIImageView] [id:logo-1] [label:Logo 1]
[UIImageView] [id:logo-2] [label:Logo 2]
[MyProject.UnderlinedTextField] [label:Email] [text:]
[UITextFieldLabel] [label:EMAIL] [text:EMAIL]
[UIAccessibilityTextFieldElement] [label:Email] [text:EMAIL]
[UIButton] [label:Let's go]
[UIButtonLabel] [label:LET'S GO] [text:LET'S GO]
true
但是,当我尝试使用 query("button")
时,我得到一个空数组。如果启用该按钮并再次使用查询,结果为:
[
[0] {
"id" => nil,
"description" => "<UIButton: 0x7fcdc8f1b6b0; frame = (23 571; 329 63); clipsToBounds = YES; opaque = NO; layer = <CALayer: 0x608000228b20>>",
"label" => "Let's go",
"frame" => {
"y" => 571,
"x" => 23,
"width" => 329,
"height" => 63
},
"accessibilityElement" => true,
"value" => nil,
"alpha" => 1,
"enabled" => true,
"visible" => 1,
"selected" => false,
"class" => "UIButton",
"rect" => {
"y" => 571,
"center_x" => 187.5,
"center_y" => 602.5,
"x" => 23,
"width" => 329,
"height" => 63
}
}
]
为什么在使用查询时未列出已禁用的按钮?有什么方法可以验证按钮是否存在,而不管其启用状态如何?
更新
当按照 jmoody 的建议使用 query ("all button")
时,我能够列出按钮。
[
[0] {
"id" => nil,
"description" => "<UIButton: 0x7fe05ad18000; frame = (23 571; 329 63); clipsToBounds = YES; opaque = NO; layer = <CALayer: 0x60000022d940>>",
"label" => "Lets go",
"frame" => {
"y" => 571,
"x" => 23,
"width" => 329,
"height" => 63
},
"accessibilityElement" => true,
"value" => nil,
"alpha" => 1,
"enabled" => false,
"visible" => 0,
"selected" => false,
"class" => "UIButton",
"rect" => {
"y" => 571,
"center_x" => 187.5,
"center_y" => 602.5,
"x" => 23,
"width" => 329,
"height" => 63
}
}
]
最佳答案
当按钮被禁用时,它在物理上是否可见?
# All buttons regardless of visibility.
query("all button")
# Ask every button if is enabled.
query("all button", :isEnabled)
# Filter buttons by disabled
query("all button isEnabled:0")
Why a disabled button is not listed when using query?
Calabash 使用可见性启发法来确定 View 是否可见。
乍一看,Calabash 似乎不会询问有关 UIControl 是启用还是禁用的任何信息来确定 View 是否可见。
关于ios - 葫芦 iOS : query not listing disabled button,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41884024/
我遇到过这个 html: 上面的html和这个有什么区别: 最佳答案 来自MDN page on the tag : 对于 type 的属性标签,可能的值是: 提交:按钮将表单数据提交给服务器
Button button= (Button) findViewbyID(R.id.button); 和 Button button = new Button(this); 有什么区别? 最佳答案 有
我是一名优秀的程序员,十分优秀!