WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

User Samples

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Get Price of Ebay Item

 Keywords: GetElementsByClassName classname class Get Read Price Ebay Item MSIE GetElementsByID GetElementsByName GetElementsByClass udfGetElementsByClass

;***************************************************************************
;**
;**
;**                  Get Price of Ebay Item
;**
;** Deana Falk 2010.06.01
;**  WinBatch 2010A
;***************************************************************************

#DefineFunction udfGetElementsByClass( objdocument, tag, searchclass  )
   ; Searches tag elements looking for a classname
   ;
   ; Parameters:
   ;   objdocument: the document object handle
   ;   tag: the html tag element to search.
   ;   searchclass: the class name to search for (case sensitive )
   ; Returns an array of element objects; all undefined elements are blank.
   arr_classElements = ArrDimension(256) ; limitation: 256 elements
   ArrInitialize(arr_classElements, "")
   els = objdocument.getElementsByTagName(tag)
   count = 0
   For i = 0 To els.length-1
      If searchclass == els.Item(i).className
         arr_classElements[count] = els.Item(i)
         count = count+1
      EndIf
   Next
   Return arr_classElements;
#EndFunction

; Get Price of Ebay Item
cEbayItem = "http://cgi.ebay.com.au/Stieg-Larsson-The-Girl-with-the-Dragon-Tattoo-NEW_W0QQitemZ180457612790QQcategoryZ377QQcmdZViewItemQQ_trksidZp4340.m263QQ_trkparmsZalgo%3DDLSL%252BPSSI%252BSI%26its%3DI%26itu%3DUCI%252BUA%252BUCK%26otn%3D10%26pmod%3D110539170069%252B110539170069%26po%3D%26ps%3D63"
oE   = ObjectCreate("InternetExplorer.Application")
oE.Visible = @TRUE
oE.Navigate(cEbayItem)

While oE.readystate<>4
   TimeDelay(1)
EndWhile

oDoc = oE.Document

; Search all 'span' elements looking for classname 'vi-is1-prcp'
arr_els = udfGetElementsByClass( oDoc, 'vi-is1-prcp', 'span' )
For i = 0 To ArrInfo(arr_els, 1 )
      els = arr_els[i]
      If els == "" Then Break
      Pause('Price', els.innertext) ; read and display the innertext ( ebay price )
Next
oDoc = 0
oE = 0
Exit


Article ID:   W18139
Filename:   Get Price of Ebay Item.txt
File Created: 2010:06:01:09:21:10
Last Updated: 2010:06:01:09:21:10