I am unable to click on the "Get Details button".
the HTML Tag is mentioned below
<button class="btn btn-success">Get Details</button>
Code:
Sub chromAuto()
Dim obj As New WebDriver
obj.Start "chrome"
obj.Get "websitedetails"
obj.FindElementById("asin").SendKeys (ThisWorkbook.Sheets("Sheet1").Range("A2").Value)
End Sub
It depends how many items there are with this class. A faster method would be to use css selectors eg
With selenium
obj.FindElementByCss(".btn-success").click
More than one element index into the nodeList
obj.FindElementsByCss(".btn-success")(1).click '1 is an example index
With ie and Microsoft Internet Controls
ie.document.querySelector(".btn-success").click
Not quite sure about the HTML environment, but you could try the following:
Dim ie_obj As Object
Set ie_obj = CreateObject("InternetExplorer.Application")
ie_obj.Visible = True
ie_obj.Navigate "www.somesite.com"
Do While ie.READYSTATE = 4: DoEvents: Loop
ie.Document.getElementsByClassName("my_name")(0).getElementsByTagName("a")(0).click
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.