inconsistent error handling if findAll() loop
In this code I am trying to use the if findAll() statement to respond when a search request generates a "This report cannot be completed" popup message.
The if findAll(): locates an image (bold type "Information" header) and seeks to click an "Ok" button then resets search parameters to start a new search.
The else: condition continues with a normal download and saves the request files in .xlsx and .pdf format.
Almost identical code versions are generating different and incorrect outcomes. Version 1 code was created in Sikuli 1.1.1, and it correctly handles the "This report cannot be completed" error condition BUT fails to handle a normal save condition.
Version 2 (created in Sikuli 1.1.0) correctly handles the else: normal download (else:), but fails on the if findAll() condition when this appears ("This report cannot be completed" popup). I have tried creating images in all the different tools, saving images in various locations and pasting in code as plain text to eliminate the impact of any version differences. No error statements are showing in either version 1 or 2, e.g. image file not found?
I am a rookie Python coder, so will not be shocked if found to be missing something obvious.
VERSION 1
click(Location(
wait(2)
type("44.07")
wait(1)
click(Location(
type(Key.ENTER)
wait(10)
r = Region(
if findAll(
click(
wait(2)
click(
click(
click(
else:
click(
click(
wait(2)
type(
wait(1)
type(
click(
() loops back to start a new search with the next set of parameters
VERSION 2
click(Location(
wait(2)
type("44.07")
wait(1)
click(Location(
type(Key.ENTER)
wait(10)
r = Region(
if findAll(
click(
wait(2)
click(
click(
click(
else:
click(
click(
wait(2)
type(
wait(1)
type(
click(
() loops back to start a new search with the next set of parameters
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Phil McCready for more information if necessary.