我正在尝试编写一个打开Internet Explorer的VBScript,导航到YouTube视频,然后按下一个按钮(下一个按钮显示在图片中) .

enter image description here

在这里你有我的代码:

Option Explicit

Dim msg, sapi, ie, shell, firstVideo

Set ie = CreateObject("InternetExplorer.Application")

ie.Navigate "https://www.youtube.com/watch?v=VisBywjQuZU"
ie.Visible = 4

waitForLoad
ie.Document.GetElementsByClassName("ytp-play-button ytp-button").Item(0).Click
waitForLoad
ie.Document.GetElementsByClassName("ytp-next-button ytp-button").Item(0).Click

'waits for ie to be completely loaded
Sub waitForLoad
    Do while ie.Busy
        WScript.Sleep 200
    Loop
End sub

正如您将通过播放脚本注意到的那样,我可以毫无问题地与播放/暂停按钮进行交互 . 但是当谈到下一个按钮时,vbs就什么都不做了 .

我怎样才能做到这一点?