提问人:tony2000 提问时间:6/27/2023 最后编辑:tony2000 更新时间:6/27/2023 访问量:54
在短 VBA 代码上使用 Chrome Selenium 的 Web Scrape 单击按钮
Web Scrape click button with Chrome Selenium on short VBA code
问:
我的目标是点击下面URL的提交按钮(在韩国)。 “https://datacentersupport.lenovo.com/us/ko/warrantylookup#/”。 VBA 源代码使用 Sendkeys 成功放置了“j30a7xlg”。
之后,要单击按钮,我尝试使用css选择器但没有成功。随附错误图像。
我也尝试了下面的xPath。但失败了。 冠心病。FindElementByXPath(“//*[@id='app-standalone-warrantylookup']/div/div[2]/div/div/div[2]/button and text()='제출']”)。点击
因此,请告知或编码如何单击按钮。 如果需要更多信息,请告诉我。
'VBA Code
Private BR_wty As New Selenium.ChromeDriver
Sub ChromeExe(ByVal c As ChromeDriver, ByVal URL As String)
c.Get URL
End Sub
Sub Scrape_WTYMY1() 'warranty
Dim URL As String, i As Integer
URL = "https://datacentersupport.lenovo.com/us/ko/warrantylookup#/"
Call ChromeExe(BR_wty, URL)
Dim chd As New Selenium.ChromeDriver '//Local var
Set chd = BR_wty
Application.ScreenUpdating = False
chd.FindElementByClass("button-placeholder__input").SendKeys "j30a7xlg"
'Q1: how to click button ERROR (image for Run-time error 11)
chd.FindElementByCss("#app-standalone-warrantylookup > div > div.warranty-lookup__content > div > div > div.basic-search__content > button").Click
Application.Wait Now() + TimeSerial(0, 0, 10)
Application.ScreenUpdating = True
End Sub
答: 暂无答案
评论
set myButton = chd.find....
myButton.scrollIntoView