Blois Posted September 17, 2020 Share Posted September 17, 2020 Hi, I need to click on several days in a day table on the web system where the datepicker property is. Here is the system code: expandcollapse popup<tbody class="datepickerDays"> <tr> <th class="datepickerWeek"> <a href="#"> <span>36</span> </a> </th> <td class="datepickerNotInMonth" data-current-date="1598886000000"><a href="#"><span>31</span></a></td> <td class="" data-current-date="1598972400000"><a href="#"><span>1</span></a></td> <td class="" data-current-date="1599058800000"><a href="#"><span>2</span></a></td> <td class="" data-current-date="1599145200000"><a href="#"><span>3</span></a></td> <td class="" data-current-date="1599231600000"><a href="#"><span>4</span></a></td> <td class="datepickerSaturday" data-current-date="1599318000000"><a href="#"><span>5</span></a></td> <td class="datepickerSunday" data-current-date="1599404400000"><a href="#"><span>6</span></a></td></tr> <tr><th class="datepickerWeek"><a href="#"><span>37</span></a></th> <td class="" data-current-date="1599490800000"><a href="#"><span>7</span></a></td> <td class="" data-current-date="1599577200000"><a href="#"><span>8</span></a></td> <td class="" data-current-date="1599663600000"><a href="#"><span>9</span></a></td> <td class="" data-current-date="1599750000000"><a href="#"><span>10</span></a></td ><td class="" data-current-date="1599836400000"><a href="#"><span>11</span></a></td> <td class="datepickerSaturday" data-current-date="1599922800000"><a href="#"><span>12</span></a></td> <td class="datepickerSunday" data-current-date="1600009200000"><a href="#"><span>13</span></a></td></tr> <tr><th class="datepickerWeek"><a href="#"><span>38</span></a></th> <td class="" data-current-date="1600095600000"><a href="#"><span>14</span></a></td> <td class="" data-current-date="1600182000000"><a href="#"><span>15</span></a></td> <td class="" data-current-date="1600268400000"><a href="#"><span>16</span></a></td> <td class="" data-current-date="1600354800000"><a href="#"><span>17</span></a></td> <td class="" data-current-date="1600441200000"><a href="#"><span>18</span></a></td> <td class="datepickerSaturday" data-current-date="1600527600000"><a href="#"><span>19</span></a></td> <td class="datepickerSunday" data-current-date="1600614000000"><a href="#"><span>20</span></a></td></tr> <tr><th class="datepickerWeek"><a href="#"><span>39</span></a></th> <td class="" data-current-date="1600700400000"><a href="#"><span>21</span></a></td> <td class="" data-current-date="1600786800000"><a href="#"><span>22</span></a></td> <td class="" data-current-date="1600873200000"><a href="#"><span>23</span></a></td> <td class="" data-current-date="1600959600000"><a href="#"><span>24</span></a></td> <td class="" data-current-date="1601046000000"><a href="#"><span>25</span></a></td> <td class="datepickerSaturday" data-current-date="1601132400000"><a href="#"><span>26</span></a></td> <td class="datepickerSunday" data-current-date="1601218800000"><a href="#"><span>27</span></a></td></tr> <tr><th class="datepickerWeek"><a href="#"><span>40</span></a></th> <td class="" data-current-date="1601305200000"><a href="#"><span>28</span></a></td> <td class="" data-current-date="1601391600000"><a href="#"><span>29</span></a></td> <td class="" data-current-date="1601478000000"><a href="#"><span>30</span></a></td> <td class="datepickerNotInMonth" data-current-date="1601564400000"><a href="#"><span>1</span></a></td> <td class="datepickerNotInMonth" data-current-date="1601650800000"><a href="#"><span>2</span></a></td> <td class="datepickerNotInMonth datepickerSaturday" data-current-date="1601737200000"><a href="#"><span>3</span></a></td> <td class="datepickerNotInMonth datepickerSunday" data-current-date="1601823600000"><a href="#"><span>4</span></a></td></tr> <tr><th class="datepickerWeek"><a href="#"><span>41</span></a></th> <td class="datepickerNotInMonth" data-current-date="1601910000000"><a href="#"><span>5</span></a></td> <td class="datepickerNotInMonth" data-current-date="1601996400000"><a href="#"><span>6</span></a></td> <td class="datepickerNotInMonth" data-current-date="1602082800000"><a href="#"><span>7</span></a></td> <td class="datepickerNotInMonth" data-current-date="1602169200000"><a href="#"><span>8</span></a></td> <td class="datepickerNotInMonth" data-current-date="1602255600000"><a href="#"><span>9</span></a></td> <td class="datepickerNotInMonth datepickerSaturday" data-current-date="1602342000000"><a href="#"><span>10</span></a></td> <td class="datepickerNotInMonth datepickerSunday" data-current-date="1602428400000"><a href="#"><span>11</span></a></td></tr> </tbody> Code I use to click on WEB objects (IE): $oIE = _IECreate("URL HERE") _IELoadWait($oIE) $oFrame = _IEFrameGetCollection($oIE, 1) $oForm = _IEFormGetObjByName($oFrame, "Frm") $oTbl = _IETagNameGetCollection($oForm, "table", 1) For $dt In $dtc If $dt.getAttribute("data-current-date") = $dts Then _IEAction($dt, "click") _IEAction($dt, "focus") _IEAction($dt, "click") EndIf Next Exit This code is not clicking on the date Obs .: I use Win10 and I am ADM Link to comment Share on other sites More sharing options...
Danp2 Posted September 17, 2020 Share Posted September 17, 2020 Your code appears incomplete. Where do $dtc and $dts get defined? Does the desired element get found? You could add a consolewrite to help with detection. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Blois Posted September 17, 2020 Author Share Posted September 17, 2020 (edited) @Danp2 Follow the complete code: $dtf = "2020/08/10" Calc_Data($dtf) $oIE = _IECreate("URL HERE") _IELoadWait($oIE) $dti = "1969/12/31 09:00:00" $dts = _DateDiff('s', $dti, $dtf & " 00:00:00") & "000" $oFrame = _IEFrameGetCollection($oIE, 1) $oForm = _IEFormGetObjByName($oFrame, "Frm") $oTbl = _IETagNameGetCollection($oForm, "table", 1) $dtc = _IETagNameGetCollection($oTbl, "td") For $dt In $dtc If $dt.getAttribute("data-current-date") = $dts Then _IEAction($dt, "click") _IEAction($dt, "focus") _IEAction($dt, "click") EndIf Next EndFunc Exit The desired element was, but the click action did not work. When no date is selected, the calendar looks like this: When you have a date selected it looks like this: Edited September 17, 2020 by Blois Link to comment Share on other sites More sharing options...
Danp2 Posted September 17, 2020 Share Posted September 17, 2020 Guessing that there are underly events not firing. Have you tried like this? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Blois Posted September 18, 2020 Author Share Posted September 18, 2020 (edited) @Danp2 I used $ object.fireEvent and didn't get the result, is it because I'm clicking on <td class = "" data-current-date = "1599750000000">? $dt.fireEvent("OnClick") $dtf = "2020/08/10" Calc_Data($dtf) $oIE = _IECreate("URL HERE") _IELoadWait($oIE) $dti = "1969/12/31 09:00:00" $dts = _DateDiff('s', $dti, $dtf & " 00:00:00") & "000" $oFrame = _IEFrameGetCollection($oIE, 1) $oForm = _IEFormGetObjByName($oFrame, "Frm") $oTbl = _IETagNameGetCollection($oForm, "table", 1) $dtc = _IETagNameGetCollection($oTbl, "td") For $dt In $dtc If $dt.getAttribute("data-current-date") = $dts Then $dt.fireEvent("OnClick") EndIf Next EndFunc Exit Edited September 18, 2020 by Blois Link to comment Share on other sites More sharing options...
Blois Posted September 18, 2020 Author Share Posted September 18, 2020 I got this action data by clicking normally on the date with the mouse. Link to comment Share on other sites More sharing options...
Danp2 Posted September 18, 2020 Share Posted September 18, 2020 Only way that I know to assist further is to examine the website (or a different one utilizing the same date control). Care to share a URL? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now