tommytx Posted July 6, 2013 Posted July 6, 2013 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") WinActivate("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 select.option.value="52961" ExitLoop EndIf Next ; <option value="52960">test-page-1</option> ; <option value="52961">test-page-2</option> Below is what the html looks like: <title>Wrappers</title> <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> </select> </div>
Moderators big_daddy Posted July 6, 2013 Moderators Posted July 6, 2013 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 EndIf Next ; Return SetError(1) EndFunc ;==>_IEGetObjByClass tommytx 1
Belini Posted July 6, 2013 Posted July 6, 2013 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) My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
trancexx Posted July 6, 2013 Posted July 6, 2013 @tommytx, discard Belini's input. That's completely off-topic for whatever reason. ♡♡♡ . eMyvnE
lionfaggot Posted July 6, 2013 Posted July 6, 2013 oh snap i didnt know about those object properties. cool, this thread gave me a bit more depth
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now