Re: [Sikuli-driver] [Question #240489]: trying to automate selecting date on a calendar on a webpage
Question #240489 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/240489 RaiMan proposed the following answer: Eugene's suggestion is ok for now. Version 1.1 will have a repeat shortcut. For dropdown menues, you always should check, wether it accepts entering the text directly and positions at the respective entry. So for the year drop down check this after having clicked open the menu: type(2013) type(Key.ENTER) same goes for the month menu type(June) type(Key.ENTER) The date/datetime modules have appropriate functions, to evaluate these items directly from your raw date. As for the selection of the day: the day area is a regular square having 5 rows each 7 columns. So you once evaluate the geometrics of this area and then you can evaluate each click point easily: # the area on your image is 228x118 # you somehow have to evaluate this are starting form a found visual (e.g. the header containing the day names) days = Region(to be evaluated) dw = 118/5 dh = 228/5 dayOne = days.topLeft().offset(dw/2, dh/2) # e.g. day 18 day = 18 dx = day % 7 dy = day // 7 this works, where the 1st is a sunday. In other cases you have to evaluate the offset using the date functions and add it: day = 18 + offset (0 for Sunday and 6 for Saturday) dx = day % 7 dy = day // 7 then simply: click(dayOne.offset((dx-1)*dw, (dy-1)*dh) an example for another calendar: https://dl.dropboxusercontent.com/u/42895525/ddcalendar.sikuli.zip -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
[Sikuli-driver] [Question #240489]: trying to automate selecting date on a calendar on a webpage
New question #240489 on Sikuli: https://answers.launchpad.net/sikuli/+question/240489 I'm currently parsing a date with originally looks like this: End Date: 12/04/14(mm/dd/yy) then i parse it so i have the values endday = time.strftime('%d', rawdate) endmth = time.strftime('%m', rawdate) endyr = time.strftime('%Y', raw date) The calendar looks like this: http://postimg.org/image/dz1y81ijh/ Then first selecting the months I'm doing something like this at least for the months: i use key.home to go to the top then use a if statement if endmth.startswith(01): type(Key.UP) type(Key.UP) type(Key.UP) type(Key.UP) type(Key.UP) type(Key.UP) type(Key.UP) type(Key.UP) type(Key.UP) type(Key.UP) type(Key.UP) elif endmth.startswith(02): type(Key.UP) type(Key.UP) type(Key.UP) type(Key.UP) type(Key.UP) type(Key.UP) type(Key.UP) type(Key.UP) type(Key.UP) type(Key.UP) elif endmth.startswith(03): So far that works for months and I assume it would work for years but the years menu goes from 1980 to 2020 So I imagine it will be too cumbersome for an if statement I'm wondering if there's something I can do that's more elegant? And as for selecting a date on the calendar I have no clue how I'm going to accomplish it because the only way is to click the day Any help or suggestions or better yet examples is appreciated :-) -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #240489]: trying to automate selecting date on a calendar on a webpage
Question #240489 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/240489 Status: Open = Answered Eugene S proposed the following answer: What I would do in your situation is write a small auxiliary function that will get the number of times the UP button should be pressed as a parameter. Then you can just call that function with a single line. It might look something like that: def buttonPress(button,count): Press any provided button for count times. for num in range(1, count+1): type(button) Then you can call it like that: buttonPress(Key.UP, timesToPress) -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp