Jump to content
Sign in to follow this  

Is it possible to use autoit to set a select when they have no id or name.

Recommended Posts

Is it possible to set a select when there is no name or id.. the only thing available is th class.. and I suppose I could figure out the index if that is the only way.. Would love to set it by class if possilbe some of what I have tried is shown here..

Thanks for any help..

#include <IE.au3>
Local $oIE = _IEAttach("Wrappers")
MsgBox(0, "","Select test-page-2 in 5 seconds.",5)
Local $oInputs = _IETagNameGetCollection($oIE, "select")
For $oInput In $oInputs
if $oInput.class = "span4 categorySelect" then

; <option value="52960">test-page-1</option>
; <option value="52961">test-page-2</option>

Below is what the html looks like:

<div class="row">
<div class="span4">

<select class="span4 categorySelect" data-categoryType="savedLink">
<option value="52960">test-page-1</option>
<option value="52961">test-page-2</option>
<option value="48010">virginia-beach-foreclosures</option>



Share this post

Link to post
Share on other sites

Unless there are many select objects on the webpage I'd get reference to it by index. If this is not an option then you can use this function:

Func _IEGetObjByClass(ByRef $o_object, $s_Class, $s_TagName = "*", $i_index = 0)
    Local $i_found = 0
    $o_tags = _IETagNameGetCollection($o_object, $s_TagName)
    For $o_tag In $o_tags
        If IsString($o_tag.className) And $o_tag.className = $s_Class Then
            If $i_found = $i_index Then Return $o_tag
            $i_found += 1
    Return SetError(1)
EndFunc   ;==>_IEGetObjByClass

Share this post

Link to post
Share on other sites

This has to take the handle hidden:

$hWnd = WinGetHandle(AutoItWinGetTitle()) ; Get the handle of the AutoIt Hidden Window by finding out the title of the AutoIt Hidden Window.
MsgBox('', '', $hWnd)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...