[英]How can I touch a UIAlertView's 'OK' or 'Cancel' button using Frank?
I have tried a few different things including this: 我尝试了一些不同的东西,包括:
When /^I touch the alertview button marked "(.*?)"$/ do |alert_btn_name|
touch "view: 'UIAlertButton' marked:'#{alert_btn_name}'"
end
and 和
When /^I touch the (\d*)(?:st|nd|rd|th)? alert view button$/ do |ordinal|
ordinal = ordinal.to_i
touch( "alertView threePartButton tag:#{ordinal}" )
end
What is a good way to go about doing this? 这样做的好方法是什么?
Your code looks good, is it not working? 你的代码看起来不错,它不工作吗?
You can also try to use the Frank predefined steps, and just do: 您还可以尝试使用Frank预定义步骤,并执行以下操作:
When I touch "Cancel"
Then I should not see an alert view
Or if you want the actual step for "When I touch ..", it would be: 或者如果你想要“当我触摸......”的实际步骤,它将是:
When /^I touch "([^\"]*)"$/ do |mark|
quote = get_selector_quote(mark)
selector = "view marked:#{quote}#{mark}#{quote} first"
if element_exists(selector)
touch( selector )
else
raise "Could not touch [#{mark}], it does not exist."
end
sleep 1
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.