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.

Select Option from Drop Down List Box

 Keywords: Select Option from Drop Down List Box 

Question:

I need to select a an option from drop down list box using it name. For example on http://www.ebay.com.au/, If i want to select "Beauty, Health" as the category (ID = _sacat) to search: Beauty, Health

Answer:

url = 'http://www.ebay.com.au'

msie = ObjectCreate("InternetExplorer.Application")
msie.visible = @TRUE
msie.navigate(url)
While msie.busy || msie.readystate <> 4
   TimeDelay(0.5)
EndWhile

; Select item in a dropdownlist by name
name = 'Beauty, Health'
dropdownlist = msie.Document.getElementByID("_sacat")
count = dropdownlist.length
list = ''
For i = 0 To count-1
    option = dropdownlist.options(i).text
    If StrLower(option) == StrLower(name)
        dropdownlist.selectedIndex=i
    EndIf
Next

msie = 0
Message("All","Done")

Reference: http://www.w3schools.com/jsref/dom_obj_select.asp


Article ID:   W18146
Filename:   Select Option from Drop Down List Box.txt
File Created: 2010:05:26:08:57:16
Last Updated: 2010:05:26:08:57:16