Xamarin UI测试点击dom

时间:2015-09-17 07:22:14

标签: xamarin

我有一个Android Xamarin应用程序,一个视图是一个webview。在那里我需要点击某个dom,但是我没有这样做。这是控制台的树输出

[[object CalabashRootView] > PhoneWindow$DecorView]                                                                                                                                                                  
[ActionBarOverlayLayout] id: "decor_content_parent"
[FrameLayout] id: "content"
  [LinearLayout > ... > RendererFactory_DefaultRenderer]
    [RendererFactory_DefaultRenderer]
      [BoxRenderer]
      [RendererFactory_DefaultRenderer > ... > WebView]
        [dom] text: "mobileForm"
        [dom] id: "mobileForm:j_idt16"
        [dom] id: "mobileForm:mobileRegistrationButton"
        [dom] id: "j_id1:javax.faces.ViewState:0" text: "-4703138551000310142:8507938265923038992"
        [dom] id: "j_id1:javax.faces.ClientWindow:0" text: "hfgsYwUuZaoRWdUVIYZM7iiP:0"
        [dom] text: "locale_mobile"
        [dom] id: "j_id1:javax.faces.ViewState:1" text: "-4703138551000310142:8507938265923038992"
        [dom] id: "j_id1:javax.faces.ClientWindow:1" text: "hfgsYwUuZaoRWdUVIYZM7iiP:0"
        [dom] text: "desktopRegistration"
        [dom] id: "desktopRegistration:desktopRegistrationButton"
        [dom] id: "j_id1:javax.faces.ViewState:2" text: "-4703138551000310142:8507938265923038992"
        [dom] id: "j_id1:javax.faces.ClientWindow:2" text: "hfgsYwUuZaoRWdUVIYZM7iiP:0"
        [dom] text: "desktopLogin"
        [dom] id: "desktopLogin:usernameField"
        [dom] id: "desktopLogin:introLoginButton"
        [dom] id: "j_id1:javax.faces.ViewState:3" text: "-4703138551000310142:8507938265923038992"
        [dom] id: "j_id1:javax.faces.ClientWindow:3" text: "hfgsYwUuZaoRWdUVIYZM7iiP:0"
        [dom] text: "locale_desktop"
        [dom] id: "j_id1:javax.faces.ViewState:4" text: "-4703138551000310142:8507938265923038992"
        [dom] id: "j_id1:javax.faces.ClientWindow:4" text: "hfgsYwUuZaoRWdUVIYZM7iiP:0"
    [RendererFactory_DefaultRenderer]
      [BoxRenderer]
      [RendererFactory_DefaultRenderer]
        [RendererFactory_DefaultRenderer]
        [RendererFactory_DefaultRenderer > MonoLabelRenderer]
          [FormsTextView] text: "Login"
        [RendererFactory_DefaultRenderer]
      [BoxRenderer]
[View] id: „statusBarBackground“

要点击的dom是[dom] id:“mobileForm:j_idt16” 是否有某种命令可以这样做?

2 个答案:

答案 0 :(得分:0)

您可以找到与webview控件进行交互的说明/教程 http://blog.zuehlke.com/en/mobile-ui-testing/

答案 1 :(得分:0)

问题的根源是我有一个较旧的Xamarin.UITest版本。根据Xamarin支持,您至少需要v1.1.0。您可以通过打开左侧树视图中的Packages文件夹找到项目中的信息。有一个叫做Xamarin.UITest的软件包。如果您需要更新它,您需要右键单击Packages文件夹并选择Update。