Jump to content

_IEFormElementOptionSelect


 Share

Recommended Posts

T3.0-2 Error from function _IEFormElementOptionSelect, $_IESTATUS_InvalidObjectType

I have a select size option on a website. I want autoit to choose "Medium" from 4 different sizes. 

I get the

 Local $oSize = _IEGetObjByName($oIE,"size",-1)

and then I want to choose a size 

_IEFormElementOptionSelect($oSize,33467)

, but I gets an error :

--> IE.au3 T3.0-2 Error from function _IEFormElementOptionSelect, $_IESTATUS_InvalidObjectType

Why do I get this error ? What's wrong there ? The whole code looks like :

Global $oIE = _IECreate('xxx',0,1,1,1)
_IELinkClickByText($oIE,'xxx',1)
Local $oSize = _IEGetObjByName($oIE,"size",-1)
_IEFormElementOptionSelect($oSize,33467,0)

 

Bez tytułu.png

Link to comment
Share on other sites

You didn't show us the associated HTML, so it's a bit difficult to really know what's going on. ;-)

That said, I suspect the error is with this line --

Local $oSize = _IEGetObjByName($oIE,"size",-1)

When you pass -1 for the 3rd parameter, the function returns a collection of objects, which isn't a valid input for _IEFormElementOptionSelect. Either remove the -1 or retrieve an individual object from the collection before passing it to _IEFormElementOptionSelect.

Link to comment
Share on other sites

I'll try in a while and let u know if it works.

@Danp2

When I change index from 1 to 0.

--> IE.au3 T3.0-2 Warning from function _IEGetObjByName, $_IESTATUS_NoMatch (Name: size, Index: 0)
--> IE.au3 T3.0-2 Error from function _IEFormElementOptionSelect, $_IESTATUS_InvalidDataType

 

kod.png

Edited by Shizu
Link to comment
Share on other sites

This seems to work --

#include <IE.au3>

$oIE = _IECreate('http://www.supremenewyork.com/shop/all/accessories')
_IELinkClickByText($oIE,'Supreme®/Hanes® Boxer Briefs (4 Pack)')

; Wait until form is present
While NOT IsObj(_IEGetObjById ($oIE, "cart-addf"))
    Sleep(500)
WEnd

$oForm = _IEFormGetCollection($oIE, 0)
$oSelect = _IEFormElementGetObjByName($oForm, 'size')

_IEFormElementOptionSelect($oSelect, 41617)

P.S. Not sure why you took this to PM unless you're sensitive about your briefs. :-P

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...