С IE - вы можете просто использовать следующее, чтобы начать загрузку при условии, что вход в систему не запрошен.
ie.document.querySelector("[data-ref=historical]").Click
Более длинная версия входа в систему:
Хорошо, что вырвало ужас после ужаса с обоими IEи Selenium, включая данные для входа, не принятые (для IE), которые были обнаружены как бот, страницы не найдены, ошибки, сгенерированные после входа в систему, ссылки на устаревшие элементы, элемент не активируется ... Ниже приведена ужасная война, которую я успешно вел, чтобы получить загрузку,Утром я посмотрю, смогу ли я найти лучший путь.
Option Explicit
Public Sub Download()
Dim d As WebDriver
Set d = New ChromeDriver
Const URL = "https://www.barchart.com/futures/quotes/ZWF9%7C530P/price-history/historical"
Const JS_WAIT_CLICKABLE = _
"var target = this, endtime = Date.now() + arguments[0];" & _
"(function check_clickable() {" & _
" var r = target.getBoundingClientRect(), x = r.left+r.width/2, y = r.top+r.height/2;" & _
" for (var e = document.elementFromPoint(x , y); e; e = e.parentElement)" & _
" if (e === target){ callback(target); return; }" & _
" if (Date.now() > endtime) { callback(target); return; }" & _
" setTimeout(check_clickable, 60);" & _
"})();" 'by @florentbr
With d
.Start "Chrome"
.get URL, timeout:=100000
.FindElementByCss("[data-ref=historical]").Click
With .FindElementsByCss("input.form-input")
.item(1).SendKeys "name"
.item(2).SendKeys "password"
End With
.FindElementByCss("[value=GO]").Click
.GoBack
.GoBack
Application.Wait Now + TimeSerial(0, 0, 5)
With .FindElementByCss("[data-ref=historical]")
.ExecuteAsyncScript(JS_WAIT_CLICKABLE, 10000) _
.Click
End With
.Quit
End With
End Sub