I'm having trouble with typing into input element in internet explorer google search using openoffice basic

Option VBASupport 1

Sub navigateurl()

    URL = "http://www.google.com"
    Set ie = CreateObject("InternetExplorer.Application")
    ie.Visible = True
    ie.Navigate URL
    
    Do While ie.ReadyState <> 4
        DoEvents
    Loop
    
    Sleep (2)
    doc = ie.document.body
    doc.getElementsByTagName("input").Item(3).Value = "sample"
    
End Sub

Sub Sleep(seconds)
  CreateObject("WScript.Shell").Run "%COMSPEC% /c ping 127.0.0.1 -n " _
    & seconds + 1, 0, True
End Sub