object has no attribute 'find' error

Asked by Dan Quimby

I'm getting the following error inconsistently:

TDTab = BrowserRegion[x].find(Pattern("1535129202271.png").similar(0.85))
AttributeError: 'NoneType' object has no attribute 'find'

Sometimes I can just rerun the script and it works fine. Other times it won't work until I restart the IDE and relaunch my script.

What's puzzling is clearly a Region has a find attribute. What would be causing my BrowserRegion list of regions to be returning the NoneType?

Thanks!

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

---What would be causing my BrowserRegion list of regions to be returning the NoneType?
IMHO only if the x is invalid

Revision history for this message
Dan Quimby (daqu40) said :
#2

This is what changes x

for x in range(len(BrowserRegion)):

This worked fine in 1.1.3

btw 1.1.4 changes to App are a massive improvement.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

has nothing to do with the change from 1.1.3 to 1.1.4 - IMHO ;-)

make it this way to debug:
TDTabReg = BrowserRegion[x]
if not TDTabReg:
   print "TDTab is None at:", x
   exit(1)
TDTabReg.find(Pattern("1535129202271.png").similar(0.85))

Revision history for this message
Dan Quimby (daqu40) said :
#4

This helped RaiMan!

Looks like I just needed to wait a bit for SikuliX to able to work with the new browser and region in BrowserRegion[x].

I'm running some tests today and will close this out if the wait() let's everything keep working.

Can you help with this problem?

Provide an answer of your own, or ask Dan Quimby for more information if necessary.

To post a message you must log in.