(Solved) – debugging mode and run mode behave different on selenium VBA (Excel)

(solved)-–-debugging-mode-and-run-mode-behave-different-on-selenium-vba-(excel)

I have searched for a while but cannot find a solution. also find similar link on this page and it is locked due to duplcation but actually it is not duplicate of anything. this is not Java or #c or anyother mentioned languages.
this is vba and selenium codes.
on below link on debugging mode (F8) everything working smoothly however on run mode (F5) it is not filling datefrom and dateto section or filling partily.

do you have any idea? also web site is a corporate web site so unfortunately I cannot share it.

Option Explicit
Sub Download_Report4()
Dim obj As New Selenium.WebDriver
Dim ele As WebElement
obj.Start "Chrome"
obj.Get "https://test.com"
Dim Username, Password As Range
Set Username = ActiveWorkbook.Sheets("LoginData").Range("B1")
Set Password = ActiveWorkbook.Sheets("LoginData").Range("B2")
           obj.FindElementById("UserName").SendKeys Username.Text
            obj.FindElementById("Password").SendKeys Password.Text
            obj.FindElementById(LoginButton").Click
            Application.Wait Now   TimeValue("00:00:02")

     Dim Rows, x

For x = 2 To Sheet1.UsedRange.Rows.count Step 1

    If IsEmpty(Sheet1.Range("A" & x)) Then
        Exit For
    Else

obj.FindElementByName("date$From").Clear
obj.FindElementByName("date$To").Clear


    obj.FindElementByName("date$From").SendKeys ("01,03,2017")
    obj.FindElementByName("datew$To").Click
       obj.FindElementByName("date$To").SendKeys (Sheet1.Range("B" & x))
       obj.FindElementById("btnSearch").Click

       obj.FindElementById("btndownload").Click
End If
Next


End Sub

by the way, date format is correct. when it is entered as 01/03/2017 chrome add dates odd. month section to date year is correct and nothing add to month section.

Leave a Reply

Your email address will not be published. Required fields are marked *