Bala98 Posted October 23, 2018 Share Posted October 23, 2018 I have a website that is using frames and I want to find the input fields inside the frame and autopopulate them with the autoitscript. Below is the page html: <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="robots" content="noindex"> <title>Site Name</title> </head> <frameset rows="*" framespacing="0" border="0" frameborder="no"> <frame src="/userui/welcome.php" name="kbox" scrolling="auto" noresize="noresize"> </frameset> <noframes> <body> <p>This site requires "frames" support by your browser.</p> </body> </noframes> </html> I am using below code to find out the field inside the frame but getting an error below. --------------------------- AutoIt Error --------------------------- Line 27 (File "D:\TestAgain.au3"): for $oInput in $oInputs for $oInput in $oInputs^ ERROR Error: Variable must be of type "Object". --------------------------- OK --------------------------- Code snippet: Local $oIE = _IECreate($url) _IELoadWait($oIE) $frames = _IEFrameGetCollection($oIE); $numFrames = @extended ; number of frames For $i = 0 to ($numFrames -1) $oFrame = _IEFrameGetCollection($oIE, $i) $oInputs = _IEFormElementGetCollection($oFrame, "input") for $oInput in $oInputs if $oInput.type = "text" And $oInput.name = "login" Then $oUser = $oInput if $oInput.type = "password" And $oInput.name = "password" Then $oPass = $oInput if $oInput.type = "submit" And $oInput.name = "save" Then $oSubmit = $oInput if isObj($oUser) And isObj($oPass) And isObj($oSubmit) then exitloop Next Would appreciate if someone can explain if this is correct way to navigate elements inside frames or there is another approach for it? Link to comment Share on other sites More sharing options...
Danp2 Posted October 23, 2018 Share Posted October 23, 2018 Check the value of @error after the call to _IEFormElementGetCollection. Hint: Your 2nd parameter is wrong. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Developers Jos Posted October 23, 2018 Developers Share Posted October 23, 2018 Moved to the appropriate forum. Moderation Team SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Bala98 Posted October 23, 2018 Author Share Posted October 23, 2018 1 hour ago, Danp2 said: Check the value of @error after the call to _IEFormElementGetCollection. Hint: Your 2nd parameter is wrong. Hi Danp2, The value of @error comes out as 4. Also updated the 2nd parameter as below: $oFrame = _IEFrameGetCollection($oIE, $i) $oInputs = _IEFormElementGetCollection($oFrame, $i) But I am still getting the same error " Error: Variable must be of type "Object". ". Link to comment Share on other sites More sharing options...
Danp2 Posted October 23, 2018 Share Posted October 23, 2018 12 minutes ago, Bala98 said: $oInputs = _IEFormElementGetCollection($oFrame, $i) This should be changed to the following if your goal is to obtain a collection of elements -- $oInputs = _IEFormElementGetCollection($oFrame, -1) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Bala98 Posted October 23, 2018 Author Share Posted October 23, 2018 18 minutes ago, Danp2 said: This should be changed to the following if your goal is to obtain a collection of elements -- $oInputs = _IEFormElementGetCollection($oFrame, -1) I am still getting the same error on changing to below: $oInputs = _IEFormElementGetCollection($oFrame, -1) Link to comment Share on other sites More sharing options...
Danp2 Posted October 23, 2018 Share Posted October 23, 2018 Ok... then you'll need to do some debugging on your own since you haven't posted code that we can actually run. Suggest that you check for @error following each call to an _IE* function. P.S. Thinking about this further, I think you're passing the wrong object as the first parameter. This should be a form object, not a frame object. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Juvigy Posted October 24, 2018 Share Posted October 24, 2018 Change this: $oInputs = _IEFormElementGetCollection($oFrame, $i) To this : $oInputs = _IETagNameGetCollection($oFrame, "input") 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