Read Two Cell Raw Data And Loop In Selenium Vba

aejaz7

New Member
Joined
Nov 6, 2018
Messages
17
I just want to read two cell raw which contain from date and to date using selenium vba. But i am unable to loop data till last cell exist.
VBA Code:
Sub Test()
Dim obj As New WebDriver,i As Integer,mysheet As Worksheet
Set mysheet = Sheets("Sheet2")
LastRow = mysheet.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LastRow

obj.FindElementByXPath("//form[@id='sum_led']/div[2]/div/div/input").SendKeys Sheet1.Cells(i, 1)
Application.Wait Now + TimeValue("00:00:01")
obj.FindElementByXPath("//form[@id='sum_led']/div[2]/div[2]/div/input").SendKeys Sheet1.Cells(i, 2)
Application.Wait Now + TimeValue("00:00:01")
obj.FindElementByXPath("//form[@id='sum_led']/div[2]/div[3]/button").Click
Application.Wait Now + TimeValue("00:00:02")

Next
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Watch MrExcel Video

Forum statistics

Threads
1,130,167
Messages
5,640,533
Members
417,151
Latest member
ChickenTenderer

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top