imgood Posted March 5, 2014 Posted March 5, 2014 Hello, I'm having trouble selecting an item in a dropdown list, could anyone guide me in the right direction? It moves on without selecting an item, I've tried to figure it out by reading the help file and looking at other forum posts but still couldn't figure it out. I have also tried "byValue" but no luck, would greatly appreciate any help. Thanks. <select name="areaabb"> <option value="oka">okinawa, jp</option> ------------------------------- $oButtons = _IETagNameGetCollection($oIE, "input") $oArea = _IEGetObjByName($oIE, "areaabb") $oAreaSelect = _IETagNameGetCollection($oArea, "select", 0) _IEAction ($oAreaSelect, "focus") _IEFormElementOptionSelect($oAreaSelect, "okinawa, jp", 1, "byText") For $oButton In $oButtons If String($oButton.type) = "submit" And String($oButton.value) = "go" Then _IEAction($oButton, "click") ExitLoop EndIf Next
Danp2 Posted March 6, 2014 Posted March 6, 2014 So both the form and the select are named "areaabb"? Run the script in Scite and post the results shown in the Output panel. Latest Webdriver UDF Release Webdriver Wiki FAQs
imgood Posted March 6, 2014 Author Posted March 6, 2014 --> IE.au3 T3.0-1 Error from function _IETagNameGetCollection, $_IEStatus_NoMatch --> IE.au3 T3.0-1 Error from function _IEAction(focus), $_IEStatus_InvalidDataType --> IE.au3 T3.0-1 Error from function _IEFormElementOptionSelect, $_IEStatus_InvalidDataType this is the part i was trying to use from firebug: (the dropdown box <section class="body"> <form action="/"> <form class="new_posting_thing" method="post" action="/login/pstrdr"> new posting in: <select name="areaabb"> <option value="">choose</option> <option value="oka">okinawa, jp</option> <option value="kor">seoul, kr</option> <input type="submit" value="go"> </form> So both the form and the select are named "areaabb"? Run the script in Scite and post the results shown in the Output panel.
Danp2 Posted March 6, 2014 Posted March 6, 2014 Your _IE commands are failing. You should add some error checking to your code. If the form name is "new_posting_thing" and the select is named "areaabb", then something like the following should work: Local $oForm = _IEFormGetObjByName($oIE, "new_posting_thing") Local $oSelect = _IEFormElementGetObjByName($oForm, ""areaabb"") _IEAction($oSelect, "focus") _IEFormElementOptionSelect($oSelect, "oka", 1, "byValue") Latest Webdriver UDF Release Webdriver Wiki FAQs
imgood Posted March 6, 2014 Author Posted March 6, 2014 (edited) --> IE.au3 T3.0-1 Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch --> IE.au3 T3.0-1 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType --> IE.au3 T3.0-1 Error from function _IEAction(focus), $_IEStatus_InvalidDataType --> IE.au3 T3.0-1 Error from function _IEFormElementOptionSelect, $_IEStatus_InvalidDataType Thank you for our help, unfortunately I have received the same error. Since it's failing starting on the very first line, i'm assuming that it's not able to find any form by the name "new_posting_thing". Is my thought correct? I also added a msgbox to see when it fails Local $oForm = _IEFormGetObjByName($oIE, "new_posting_thing") If IsObj($oForm) Then _IEAction ($oForm, "click") MsgBox(16, "Success", "new posting thing have been found)") Else MsgBox(16, "Failed", "Not found.") EndIf Local $oSelect = _IEFormElementGetObjByName($oForm, "areaabb") _IEAction($oSelect, "focus") _IEFormElementOptionSelect($oSelect, "oka", 1, "byValue") Edited March 6, 2014 by imgood
Danp2 Posted March 6, 2014 Posted March 6, 2014 Yes... you need to figure out why the form isn't being found. Is the form name correct? Are there any frames involved? What website are you attempting to automate? Latest Webdriver UDF Release Webdriver Wiki FAQs
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