How to handle enable/Disbale state of the button

Asked by sudhir takale

Hi

I want to click the button still it gets disabled. How to handle this situation. Kindly suggest

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
sudhir takale (sudhirtakale) said :
#1

When i used following code

button = Pattern("img1").exact()
while button.exists(Pattern("img1").exact()):
      click(button)

getting error message cannot used exists with button.

Revision history for this message
obiwan-92 (obiwan-92) said :
#2

Hello,

I understand, try this instead :

button = Pattern("img1").exact()
while exists(button):
      click(button)

Regards.

Revision history for this message
sudhir takale (sudhirtakale) said :
#3

How to check the button gets enabled and disabled

Revision history for this message
Eugene S (shragovich) said :
#4

Hi,

What about creating a pattern for each one of the states and then try to find each one?
For example

if exists("ButtonState1.png"):
   print "The button state is 1"
   # Additional action for that case
elif exists("ButtonState2.png")
   print "The button state is 1"
   # Additional action for that case
else:
   # Additional action for that case

Or alternatively create just one pattern and use something like this:

try:
   find("ButtonState1.png")
   print "The button state is 1"
   #Additional action
except:
   print "State 1 button was not found"
   #Additional action

Eugene

Can you help with this problem?

Provide an answer of your own, or ask sudhir takale for more information if necessary.

To post a message you must log in.