4

In XCUITest, I am struggling to interact with webview elements. The app I am trying to automate mainly consists of native screens, which work fine, but some flows are in webviews, which obviously have no AccessibilityIDs like the native elements.

This must be a fairly commonplace occurrence needed in app automation.

I tried one suggestion of using an tag on the web element, but this also did not work.

I am simply trying to interact with the webform as user would, I can somewhat use some elements by referencing StaticText but this is a bad approach.

  • Possible duplicate of [How to run javascript and fetch a value of hidden variable in page source using XCUITest?](https://stackoverflow.com/questions/39472898/how-to-run-javascript-and-fetch-a-value-of-hidden-variable-in-page-source-using) – Anton Belousov May 21 '18 at 10:32
  • This user appears to be asking how to fetch hidden variables which is not really UI automation, I am just wanting to interact with elements that are clearly visible to users such as textboxes/buttons etc. – Simon Gilmurray May 21 '18 at 14:55
  • check answers please – Anton Belousov May 21 '18 at 15:47
  • So the answer is that there is zero way to interact with any web elements in XCUITest? That would totally invalidate its use on every hybrid app... – Simon Gilmurray May 22 '18 at 16:09
  • `XCUITest` was designed for native controls, which expose accessibility details. Web contents don't do this, if they would do, they would be usable in UI test. – Cristik Jan 28 '19 at 22:48
  • What kind of webview are you using? WKWebView? – Chris Jan 31 '19 at 11:44

0 Answers0