Я пытаюсь передать данные в форму, которая находится на четвертой странице.Я успешно прошел через макрос, выполнив вход, выполняя поиск конкретной страницы на основе введенных данных, переходя на эту конкретную страницу и вытягивая форму, в которой я хочу вводить данные в несколько мест.
Sub Test()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "http://mywebsite.com/Pages/MainSite/Default.aspx"
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
IE.document.getElementById("txtUserName").Value = "dummyusername"
IE.document.getElementById("txtPassword").Value = "password"
IE.document.getElementById("btnLogin").Click
End Sub
Sub Next2()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "mywebsite.com/pages/hr/TimeEntryDashboard.aspx"
Do While IE.Busy
Application.Wait DateAdd("s", 2, Now)
Loop
IE.document.getElementById("MainContent_MainContent_txtStartDateFilter").Value = "10/13/2018"
IE.document.getElementById("MainContent_MainContent_txtEmployeeNameFilter").Value = "122631"
IE.document.getElementById("MainContent_MainContent_btnFind").Click
End Sub
Sub Next3()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "mywebsite.com/pages/hr/TimeAndInspectionWizard.aspx?id=0245b750-4cde-47da-a754-fb7f8bfecfc9"
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
IE.document.getElementById("imgGridTimeDetailsArrow0").Click
IE.document.getElementById("MainContent_MainContent_tcMain_tpValidation_rptInspectionDetails_imbGridInspectionDetailsOptionsAdd_0").Click
End Sub
Sub Next4()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
' IE.Visible = True
' IE.Navigate "mywebsite.com/pages/hr/TimeAndInspectionWizard.aspx?id=0245b750-4cde-47da-a754-fb7f8bfecfc9"
Do While IE.Busy
Application.Wait DateAdd("s", 2, Now)
Loop
IE.document.getElementById("MainContent_MainContent_tcMain_tpInspectionDetails_txtInspectionDetailsLotNumber").Value = "12345"
IE.document.getElementById("MainContent_MainContent_tcMain_tpInspectionDetails_txtInspectionInspectedQuantity").Value = "1"
IE.document.getElementById("MainContent_MainContent_tcMain_tpInspectionDetails_txtGoodWithoutReworkQuantity").Value = "1"
IE.document.getElementById("MainContent_MainContent_tcMain_tpInspectionDetails_txtAddInspectionResult").Click
End Sub
Эта часть выше вызывает ошибку в первом разделе, где предполагается ввод данных на экран.