Shizu Posted April 14, 2017 Share Posted April 14, 2017 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) Link to comment Share on other sites More sharing options...
Danp2 Posted April 14, 2017 Share Posted April 14, 2017 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. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Shizu Posted April 14, 2017 Author Share Posted April 14, 2017 (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 Edited April 14, 2017 by Shizu Link to comment Share on other sites More sharing options...
Shizu Posted April 14, 2017 Author Share Posted April 14, 2017 Could some1 help me guys ? Link to comment Share on other sites More sharing options...
Danp2 Posted April 14, 2017 Share Posted April 14, 2017 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. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted April 14, 2017 Share Posted April 14, 2017 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 Shizu 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Shizu Posted April 14, 2017 Author Share Posted April 14, 2017 That's not about briefs. Didnt want to advertise any shop/site. Thanks dude. Link to comment Share on other sites More sharing options...
Shizu Posted April 14, 2017 Author Share Posted April 14, 2017 Btw. still doesnt work. --> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (cart-addf) Link to comment Share on other sites More sharing options...
Danp2 Posted April 14, 2017 Share Posted April 14, 2017 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. Shizu 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Shizu Posted April 14, 2017 Author Share Posted April 14, 2017 Yeah works right now, had to change the ID. Thank You Dan. Link to comment Share on other sites More sharing options...
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