PDA

View Full Version : select item with macro



Galactico
04-15-2019, 11:56 AM
Hi, I want to automate the assembly of a shopping cart, but I can not add element that I need, if I delete the text that says ".getAttribute("NM-Mint, English")(0)" the macro can add an element to the car, but this is defined by position, I need to make some kind of filter, since the order of the state (NM-Mint, Sightly Played, Moderately Played and Damaged) of the product changes, or in some it does not appear.

I know that the key is in the "data-variant" attribute, but I am recently learning vba macro and my knowledge is limited in this aspect, that's why I ask for your help.


Excuse my English level, I'm from South America


I greatly appreciate your help.




Sub test1()

Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")


With IE
.Top = 0
.Left = 0
.height = 1000
.Width = 1050
.Visible = True
.Navigate "https://store.channelfireball.com/catalog/magic_singles-kaladesh_block-aether_revolt/fatal_push/578973"


Do While .Busy Or Not .ReadyState = 4: DoEvents: Loop




.Document.getElementsByClassName("add-to-cart-form")(0).getAttribute("NM-Mint, English")(0).getElementsByClassName("qty")(0).Value = "1"
.Document.getElementsByClassName("utility-button add-to-cart")(1).Click




End With
End Sub


thanks!!

Galactico
04-25-2019, 01:36 PM
can anybody help me?