Shizu

_IEFormElementOptionSelect

10 posts in this topic

#1 ·  Posted

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

Share this post


Link to post
Share on other sites



#2 ·  Posted

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.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#4 ·  Posted

Could some1 help me guys ? 

 

Share this post


Link to post
Share on other sites

#5 ·  Posted

Please provide a URL or save the full HTML to a file and post it to the forum so that we can review it. Without that, we are just guessing at the issue.

Share this post


Link to post
Share on other sites

#6 ·  Posted

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

1 person likes this

Share this post


Link to post
Share on other sites

#7 ·  Posted

That's not about briefs. Didnt want to advertise any shop/site.

 

Thanks dude.

Share this post


Link to post
Share on other sites

#8 ·  Posted

Btw. still doesnt work. 

--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (cart-addf)

 

Share this post


Link to post
Share on other sites

#9 ·  Posted

Actually, it's working exactly as designed. You may see that error one or more times because the website hasn't fully loaded. Take a look at the While loop and that's were the _IEGetObjById call is located.

1 person likes this

Share this post


Link to post
Share on other sites

#10 ·  Posted

Yeah works right now, had to change the ID. Thank You Dan.

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