Jump to content
Sign in to follow this  
imgood

IE: DropDown Box Help

Recommended Posts

imgood

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
 

Share this post


Link to post
Share on other sites
imgood

--> 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.

Share this post


Link to post
Share on other sites
Danp2

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")

Share this post


Link to post
Share on other sites
imgood

--> 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 by imgood

Share this post


Link to post
Share on other sites
Danp2

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?

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  

×