Error automating website data entry as the website is still loading

后端 未结 3 1861
悲&欢浪女
悲&欢浪女 2021-01-25 09:49

I have code which picks up data from multiple columns from ThisWorkbook and puts in various field in website in internet explorer. The website loads after clicking on <

3条回答
  •  甜味超标
    2021-01-25 10:31

    I have removed below wait loop after line 1.

        'Wait till it loads
        Do While IE.Busy
            Application.Wait DateAdd("s", 5, Now)
        Loop
    

    and added fix 10 seconds wait time Application.Wait DateAdd("s", 10, Now) just before

        doc.getElementById("ContentPlaceHolder1_GridView1_chkboxSelectAll").Click
        'Wait 3 seconds till it selects all the checkboxes
        Application.Wait DateAdd("s", 3, Now)
    

    So the final piece of code is as below and it's working!

    'This is the Line1
            doc.getElementById("ContentPlaceHolder1_search").Click
    
            'Checkbox select all
    'This is the Line2
            Application.Wait DateAdd("s", 10, Now)
            doc.getElementById("ContentPlaceHolder1_GridView1_chkboxSelectAll").Click
            'Wait 3 seconds till it selects all the checkboxes
            Application.Wait DateAdd("s", 3, Now)
    

提交回复
热议问题