gpt4 book ai didi

ios - iOS7 中 UIAlertView 的葫芦问题

转载 作者:行者123 更新时间:2023-11-28 22:16:01 25 4
gpt4 key购买 nike

在 iOS 7 之后,我们遇到了使用葫芦验证 UIAlertView 的问题。

现在我可以使用

检测警报消息
wait_for_elements_exist(["view:'_UIModalItemRepresentationView'"], :timeout => 20)
query("view:'_UIModalItemRepresentationView' label marked:'#{text}'",).empty?

我的想法来自 https://gist.github.com/seanoshea/7613671

但以前(在 iOS 6 中)我们能够像这样清楚地检测到消息和标题

title = query("view:'UIAlertView'",:title).first
msg = query("view:'UIAlertView'",:message).first

有什么方法可以在 iOS7 中做同样的事情吗?我认为“坦率”的人也这样做https://github.com/moredip/Frank/pull/262 .

备注:jmoody请帮助我们解决葫芦自动化中的这个 iOS 7 警报。

最佳答案

目前我一直在使用这个解决方案。如果有人遇到同样的问题,可以使用它,直到我们找到好的解决方案。

Then /^I should see empty email alert$/ do
is_alert_exist_with_text("Email cannot be empty.")
sleep(0.5)
touch_alert_button("OK")
end
######## 定义函数
def touch_alert_button(button)
btn = query("view:'_UIModalItemTableViewCell' label marked:'#{button}'").first.empty?
if (btn)
screenshot_and_raise "button not found '#{button}'"
else
touch("view:'_UIModalItemTableViewCell' label marked:'#{button}'").first
sleep(0.2)
end
end

def is_alert_exist_with_text(text)
unless query("view:'_UIModalItemRepresentationView' label marked:'#{text}'",).empty?
return true
else
screenshot_and_raise "could not find the text '#{text}' in alert view"
end
end

进一步...

def is_alert_exist_with_title_and_message(title, message)
elements = query("view:'_UIModalItemRepresentationView' label", 'text')
buttons = query("view:'_UIModalItemTableViewCell' label", 'text')
textLabels = elements - buttons

if (textLabels.count == 2)
screenshot_and_raise "Alert Title '#{title}' not found" unless (textLabels[0].eql? title)
screenshot_and_raise "Alert Message '#{message}' not found" unless (textLabels[1].eql? message)
else
screenshot_and_raise "Argument error...isAlertExistWithTitleAndMessage function"
end
end

关于ios - iOS7 中 UIAlertView 的葫芦问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21657093/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com