Reputation: 35
Error message is against EditText field. We don't have any direct locator available which points to error message. Can anyone suggest what alternate we have to handle this in appium.
Upvotes: 0
Views: 1743
Reputation: 163
Try this method if you are not able to assert Error message against EditText field.
Convert image to text file
def assettoast(string)
sname = (0...8).map { (65 + rand(26)).chr }.join
$driver.driver.save_screenshot("#{sname}")
#Make sure tesseract is installed in the system. If not you can install using "brew install tesseract" in mac
system ("tesseract #{sname} #{sname}")
text_file="#{sname}.txt"
var= get_string_from_file(string, text_file)
raise if var != true
end
Check whether error message is there in text file
def get_string_from_file(word, filename)
File.readlines(filename).each do |line|
return true if line.include?(word)
end
end
Upvotes: 3
Reputation: 3658
There is no you will get using uiautomatorviewer and Google's original UiAutomator. Check old thread
However you may try Appium own implementation UiAutomator2 and Appium desktop inspector, maybe it will parse error.
Otherwise there is new appium end-point to compare images:
/session/:sessionId/appium/compare_images
You can use it to verify the error on screen
Upvotes: 0