Vikas Kumar
New Member
- Joined
- Apr 2, 2017
- Messages
- 49
Hi Friends,
I am trying to choose a date from webpage, by date picker calendar and fortunately reached for a mile with my current code,
_________________________________________________________________________________________
Driver.FindElementById("validtill").Click
d = Sheet1.Range("BA2")
n = Now()
'current month
If Range("BF1") = Month Then
Driver.FindElementByLinkText(Day(d)).Click
End If
If Range("BF1") = Month + 1 Then
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText(Day(d)).Click
End If
If Range("BF1") = Month + 2 Then
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText(Day(d)).Click
End If
If Range("BF1") = Month + 3 Then
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText(Day(d)).Click
End If
If Range("BF1") = Month + 4 Then
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText(Day(d)).Click
End If
If Range("BF1") = Month + 5 Then
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText(Day(d)).Click
End If
If Range("BF1") = Month + 6 Then
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText(Day(d)).Click
End If
If Range("BF1") = Month + 7 Then
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText(Day(d)).Click
End If
If Range("BF1") = Month + 8 Then
Driver.FindElementByLinkText("Next").Click
_________________________________________________________________________________________
This works fine for 2018 but doesn't go ahead from 2018. Say I would like to select from today (2018) to 01-Jan-2019 then it falls on 31-Dec-2018 and don't step beyond. Here is a mirror copy of Inspect Element Page for better understanding, (Quoted Symbols because of was unable to post without it),
"<"td height="20" align="left" width="60%">"
"<"input type="text" id="validtill" value=" name="validtill" readonly="readonly" class="hasDatepicker">"
"<"span id="validTillError" style="color:red;font-weight: bold;">" "<"/span">"
Also linked image of webpage
Any help about how to get this done, Would be appreciated.
I am trying to choose a date from webpage, by date picker calendar and fortunately reached for a mile with my current code,
_________________________________________________________________________________________
Driver.FindElementById("validtill").Click
d = Sheet1.Range("BA2")
n = Now()
'current month
If Range("BF1") = Month Then
Driver.FindElementByLinkText(Day(d)).Click
End If
If Range("BF1") = Month + 1 Then
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText(Day(d)).Click
End If
If Range("BF1") = Month + 2 Then
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText(Day(d)).Click
End If
If Range("BF1") = Month + 3 Then
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText(Day(d)).Click
End If
If Range("BF1") = Month + 4 Then
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText(Day(d)).Click
End If
If Range("BF1") = Month + 5 Then
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText(Day(d)).Click
End If
If Range("BF1") = Month + 6 Then
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText(Day(d)).Click
End If
If Range("BF1") = Month + 7 Then
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText("Next").Click
Driver.FindElementByLinkText(Day(d)).Click
End If
If Range("BF1") = Month + 8 Then
Driver.FindElementByLinkText("Next").Click
_________________________________________________________________________________________
This works fine for 2018 but doesn't go ahead from 2018. Say I would like to select from today (2018) to 01-Jan-2019 then it falls on 31-Dec-2018 and don't step beyond. Here is a mirror copy of Inspect Element Page for better understanding, (Quoted Symbols because of was unable to post without it),
"<"td height="20" align="left" width="60%">"
"<"input type="text" id="validtill" value=" name="validtill" readonly="readonly" class="hasDatepicker">"
"<"span id="validTillError" style="color:red;font-weight: bold;">" "<"/span">"
Also linked image of webpage
Any help about how to get this done, Would be appreciated.