代码之家  ›  专栏  ›  技术社区  ›  Woj

Xamarin UITest iOS无法访问webview元素

  •  -1
  • Woj  · 技术社区  · 8 年前

    我在iOS上检测webview中的元素似乎有问题,android看起来不错。

    enter image description here

    当我调用tree来查看可见项时,我会得到结果,但是每当我尝试查询任何项时,都不会得到结果。我试过:

    app.Query(c => c.WebView().Css("fullPage")) 
    app.Query(c => c.WebView().Css("#fullPage")) 
    app.Query(c => c.Marked("#userNameArea"))  
    app.Query(c => c.Id(("#userNameArea"))
    

    app.Query(c => c.XPath("//userNameInput")) 
    

    我做错什么了?

    1 回复  |  直到 8 年前
        1
  •  0
  •   Woj    8 年前

    对于那些在iOS上遇到类似问题的人,您必须调用类而不是WebView本身。在我的情况下,我必须:

    app.Tap(c => c.Class("BrandU_iOS_AuthenticatingWebViewRenderer").Css("#userNameInput"));