我无法使用calabsh在iOS ui上点击元素

时间:2015-04-24 09:26:45

标签: ios label calabash calabash-ios

我在iOS应用上有一个标签,我无法触及

irb(main):022:0> label "label"
[
    [0] "Create account",
    [1] "Log in",
    [2] "com.blabla - v505"
]

我想点击基本上是这个

的最后一个元素
irb(main):014:0> query("view {accessibilityLabel LIKE 'com.blabla*'}")
[
    [0] {
              "class" => "UILabel",
                 "id" => nil,
               "rect" => {
            "center_x" => 160,
                   "y" => 519,
               "width" => 280,
                   "x" => 20,
            "center_y" => 540.5,
              "height" => 43
        },
              "frame" => {
                 "y" => 519,
             "width" => 280,
                 "x" => 20,
            "height" => 43
        },
              "label" => "com.blabla - v505",
        "description" => "<UILabel: 0x7a1ebac0; frame = (20 519; 280 43); text = 'com.blabla.enterprise.cal....'; clipsToBounds = YES; opaque = NO; autoresize = W+TM; gestureRecognizers = <NSArray: 0x7a1e8900>; layer = <_UILabelLayer: 0x7a1ebbe0>>"
    }
]

我尝试了不同的方法来点击该元素,但都给了我同样的错误

NoMethodError: undefined method `to_sym' for nil:NilClass

我尝试了以下

. touch("view {accessibilityLabel LIKE 'com.blabla*'}")
. tap_mark label("label")[2]

任何想法或建议让我能够触摸该标签?

1 个答案:

答案 0 :(得分:0)

你试过var passWindow = document.activeElement; // "self" is a global object in content scripts // Listen for a "enterPass" self.port.on("enterPass", function(pass) { passWindow.value = pass; }); self.port.on("focusPass", function() { console.log("focusing!"); passWindow.focus(); }); 吗?也许我在误解。