0

I am trying to click on a button but it has no name or id the code from the website is below

<a href="https://www.supremenewyork.com/checkout" class="button checkout">checkout now</a>

I have the following so far

set webrowser = createobject("internetexplorer.application")
webrowser.statusbar = false
webrowser.menubar = false
webrowser.toolbar = false
webrowser.visible = true
webrowser.navigate("http://www.supremenewyork.com/shop/jackets/quilted-flight-satin-parka/orange")
wscript.sleep(5000)     
webrowser.document.all.item("size").value = "30418"
wscript.sleep(500)
webrowser.document.all.item("commit").click
wscript.sleep(500)
For Each btn In webrowser.Document.getElementsByTagName("input")
    If btn.type= "button checkout" Then btn.Click()
Next
colliers1
  • 31
  • 1
  • 3

1 Answers1

0

Replace the last three lines of your code with:

For Each btn In webrowser.Document.getElementsByClassName("button checkout")
    If btn.href = "https://www.supremenewyork.com/checkout" Then btn.Click()
Next

The loop actually only finds the one button, so you could just click it without the 'if'... but it's safer with the if.

David
  • 1,222
  • 1
  • 8
  • 18