Using 'accessibilityIdentifier' for webview

Hi,

Right now we are iterating/switching over available webviews and recognizing the one we want to stay on by examining if page.title property has specific string value

This works well on Android for our application and it used to work on iOS. There was 3rd webview created after user logged in and it was selected properly. After some changes in the app and adding 4th webview that is being created only for a while but has same page.title property. This results in switching to a webview that will cease to exist in a few seconds which results in our test to hang.

We know that the application is setting webview name with this method https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIAccessibilityIdentification_Protocol/#//apple_ref/occ/intfp/UIAccessibilityIdentification/accessibilityIdentifier

We think it should be visible as ‘name’ property: https://developer.apple.com/library/ios/documentation/ToolsLanguages/Reference/UIAElementClassReference/index.html#//apple_ref/javascript/instm/UIAElement/name

A question is how to reference it from our code, we are using ruby, currently we have this function:

  def find_window_with_title(title, wait: FIND_WINDOW_TIMEOUT, ...)
    index = 0
    Timeout.timeout(wait) do
      loop do
        length = page.driver.window_handles.length
        windows = page.driver.window_handles
        # windows[index] can become null
        begin
          page.driver.switch_to_window windows[index] unless windows[index].nil?
          index = (index + 1) % length
          log_hybrid_helper "Iterating over window(webview) with title: #{page.title}"

          unless page.nil? || page.title.nil? || page.title.empty?
             break if page.title.include? title
          end
        rescue NoMethodError => e
          #ignore this error as it is expected when page becomes nil after logout
        end
      end
    end
...
    log_hybrid_helper "Switched to window(webview) with title: #{page.title}"
  end

Any hints will be appreciated.