← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #267957]: I am new on sikuli and started using sikuli as project requirement.PLease tell me any advance sikuli tutorial website

 

Question #267957 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/267957

Zeks posted a new comment:
9) Abstract away interface elements such as buttons and table cells
When you write 
	click(Pattern('send.png'))
what you really want is to click on button, not on screenshot. And buttons have states.
A button can be pressed, hovered or cleaned, same with table cells. Instead what will save you time is:
	clickEntity('button')
the clickEntity function you will have to write yourself. It needs to match not one, but 3 screenshots and give/click the best match.
How it will do that is debatable. I, at the moment, do stuff like this
	buttons = ['send', {name = 'send', states = ['clean', 'hovered', 'pressed']}]
In the folder there are files send_clean.png, send_hovered.png... 
So if I have a send window it is implemented in Send module and used as
	Send.clickEntity('send')
The function iterates over buttons dictionary, creating names as it goes and tries to find each one.

The result? Where you'd likely have to write in the main script(each
time):

	click(Pattern('send_clean.png'))
	if not 
		click(Pattern('send_hovered.png'))
	if not
		click(Pattern('send_.png'))
		
it becomes simple 		
	Module.click('entity')
	
this helps both readability and abstraction and will likely save you a lot of time

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.