此代码在运行从本地.app生成的.app文件时工作正常,但无法从hockeyapp ior应用商店中获取运行的.app / IPA文件时的webview
def switch_context(context, next_element)
puts "Starts switching context"
puts available_contexts
#binding.pry
contexts = available_contexts
i = 1
if context == 'native'
set_context("NATIVE_APP")
else
begin
while i < contexts.size
puts "Webview switching starting from front"
puts "Switching to new context #{i}"
set_context(available_contexts[i])
i += 1
sleep 1
is_present = exists {find_element(:xpath, "//*[@id='#{next_element}']")}
puts "Element is #{is_present} present"
if is_present #check if context has web element
puts "Context found"
break
end
end
end
end