sleep 10 #獲取最新的驗證碼以后,加個sleep等待時間,貌似IE需要時間緩存最新的驗證碼code,否則@b對象獲取不到最新的驗證碼code而登陸失敗
if @b.text.include?(ExpectData("expect1")) == true #是否存在“商家登錄”
xxx_login(user,pwd,code)
elsif @b.text.include?(ExpectData("expect2")) == true #是否存在“退出”
xxx_www_logout
xxx_login(user,pwd,code)
end
break if times >= 5 or @b.text.include?(ExpectData("expect2")) == true #是否存在“退出”
end #loop end end
原文轉自:http://www.anti-gravitydesign.com