Orgins Posted May 29, 2008 Share Posted May 29, 2008 (edited) It’s kinda hard to explain but there’s a button I want to _IEAction click but it’s not exactly on the pages source code. The source code had: <script type="text/javascript" src="jscripts/xxxx.js"></script> the www.url.com/jscripts/xxxx.js has: o.innerHTML += "<div class='ab'><input type=submit onclick='a.c.value=30' name='submit' value='submit' ></div>"; How would I click that? I’ve tried: (and 20+ other ways) #include <IE.au3> $oIE = _IECreate ("the url”) $oIE2 = _IEAttach ("the title", "embedded") $oQuery = _ _IEGetObjByName ($oIE2, " submit ") _IEAction ($oQuery, "click") _IELoadWait ($oIE) But I get: C:\PROGRA~1\AutoIt3\Include\IE.au3 (4088) : ==> Subscript used with non-Array variable.: If IsObj($aRet[4]) Then If IsObj($aRet^ ERROR ->00:52:37 AutoIT3.exe ended.rc:1 I’m thankful for everyone’s help on my other topic and I know it seems like I'm needy and not trying to figure stuff out my self but I really am and I’m out of things to try. Any pointers would be nice. Edited May 29, 2008 by Orgins I'm a newbie.Sorry if I don't reposed to your replays very fast. Link to comment Share on other sites More sharing options...
Valuater Posted May 29, 2008 Share Posted May 29, 2008 Not enough info for me... But, try this #include <IE.au3> $URL = "www.Autoit.com" $oIE = _IECreate($URL) $oQuery = _IEGetObjByName($oIE, "submit") _IEAction($oQuery, "click") _IELoadWait($oIE) Obviously replace the Autoit URL 8) Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 29, 2008 Share Posted May 29, 2008 Its kinda hard to explain but theres a button I want to _IEAction click but its not exactly on the pages source code.You don't click the source or the script that created the element in a web page, you click on the element itself in the browser's document AFTER it is rendered. Get an object reference to the input named "submit" from the rendered page, and then click that. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
DaleHohm Posted May 29, 2008 Share Posted May 29, 2008 Suggest you install and use DebugBar (see my sig) that will show you the rendered page structure. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Orgins Posted May 29, 2008 Author Share Posted May 29, 2008 @Valuater thinks but thats one of the first ones I tried. K I used the DeBugBar and the button I want to push is: <INPUT onclick=formObj.c.value=11 type=submit value="submit "> and one up: <DIV class="p3 ce ab"><INPUT onclick=formObj.c.value=11 type=submit value="submit "></DIV> There's no Id or name how would I get a object reference? I'm a newbie.Sorry if I don't reposed to your replays very fast. Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 29, 2008 Share Posted May 29, 2008 @Valuater thinks but thats one of the first ones I tried.K I used the DeBugBar and the button I want to push is:<INPUT onclick=formObj.c.value=11 type=submit value="submit ">and one up:<DIV class="p3 ce ab"><INPUT onclick=formObj.c.value=11 type=submit value="submit "></DIV>There's no Id or name how would I get a object reference?You've already seen this. If it's in a form, reference the form first, then _IEFormElementGetObjByName() to get the reference to the input, then _IEAction() on the input element. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Orgins Posted May 29, 2008 Author Share Posted May 29, 2008 (edited) But it doesn't have a name or Id. #include <IE.au3> $oIE = _IECreate ("the url”) $oForm = _IEFormGetObjByName ($oIE, "a") <-is the only form $oQuery = _ _IEFormElementGetObjByName($oForm, " submit ") <---what do I use as the name? _IEAction ($oQuery, "click") _IELoadWait ($oIE) --> IE.au3 V2.3-1 Warning from function _IEFormElementGetObjByName, $_IEStatus_NoMatch --> IE.au3 V2.3-1 Error from function _IEAction, $_IEStatus_InvalidDataType Sorry I'm thick. Edited May 29, 2008 by Orgins I'm a newbie.Sorry if I don't reposed to your replays very fast. Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 29, 2008 Share Posted May 29, 2008 (edited) But it doesn't have a name or Id. #include <IE.au3> $oIE = _IECreate ("the url) $oForm = _IEFormGetObjByName ($oIE, "a") <-is the only form $oQuery = _ _IEFormElementGetObjByName($oForm, " submit ") <---what do I use as the name? _IEAction ($oQuery, "click") _IELoadWait ($oIE) --> IE.au3 V2.3-1 Warning from function _IEFormElementGetObjByName, $_IEStatus_NoMatch --> IE.au3 V2.3-1 Error from function _IEAction, $_IEStatus_InvalidDataType Sorry I'm thick. Nope. My mistake, I thought I read name = "Submit" there. Sorry for the misdirection. Get the collection of "Input" tags with _IETagNameGetCollection(), then loop through the collection to find $oInput.value = "submit". $colInputs = _IETagNameGetCollection($oForm, "Input") For $oInput In $colInputs If $oInput.value = "submit" Then _IEAction($oInput, "click") ExitLoop EndIf Next Edit: Fixed YASM (Yet Another Stupid Mistake). Edited May 29, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Orgins Posted May 29, 2008 Author Share Posted May 29, 2008 (edited) Where's the $oSubmit (its undeclared) come from? I tried $colInputs = _IETagNameGetCollection($oForm, "Input") For $oInput In $colInputs If $oInput.value = "submit" Then $oSubmit = $oInput _IEAction($oSubmit, "click") ExitLoop EndIf Next No errors but it doesn't click the button. /e thinks for helping. Edited May 29, 2008 by Orgins I'm a newbie.Sorry if I don't reposed to your replays very fast. Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 29, 2008 Share Posted May 29, 2008 Where's the $oSubmit (its undeclared) come from? I tried $colInputs = _IETagNameGetCollection($oForm, "Input") For $oInput In $colInputs If $oInput.value = "submit" Then $oSubmit = $oInput _IEAction($oSubmit, "click") ExitLoop EndIf Next No errors but it doesn't click the button. /e thinks for helping. That's a mistake, and should be _IEAction($oInput, "click"). I originally had $oSubmit = $oInput, and the the click outside the loop, but simplified it without fixing the variable name. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
DaleHohm Posted May 29, 2008 Share Posted May 29, 2008 Also suggest using: If String($oInput.value) = "submit" Then If you don't force String and .value happens to be Null, it returns numeric 0... and surprise! (If 0 = "submit") evaluates to True Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Orgins Posted May 29, 2008 Author Share Posted May 29, 2008 If String($oInput.value) = "submit" Then does the same as If $oInput.value = "submit" Then. No errors but doesn't click the submit button. Thinks for the help (everyone) I'm going reread/redo/retry everything maybe I missed something. I'm a newbie.Sorry if I don't reposed to your replays very fast. Link to comment Share on other sites More sharing options...
Orgins Posted May 30, 2008 Author Share Posted May 30, 2008 K I've reread/redone/retried everything I can think of. Any suggestions? Even if you don't think it'll work I'm willing to try it. I'm a newbie.Sorry if I don't reposed to your replays very fast. Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 30, 2008 Share Posted May 30, 2008 K I've reread/redone/retried everything I can think of. Any suggestions? Even if you don't think it'll work I'm willing to try it. Have you verified that you are finding the object, but clicking is not working? For example: $colInputs = _IETagNameGetCollection($oForm, "Input") For $oInput In $colInputs If String($oInput.value) = "submit" Then _IEAction($oInput, "click") MsgBox(64, "Click", "Just clicked on 'submit'") ExitLoop EndIf Next It's important to know if you are not finding the input object, or the click action is not triggering the response expected. If you get the valid object and "click" is not working then maybe you could try Dale's second example under _IEAction(): ; ******************************************************* ; Example 2 - Same as Example 1, except instead of using click, give the element focus ; and then use ControlSend to send Enter. Use this technique when the ; browser-side scripting associated with a click action prevents control ; from being automatically returned to your code. ; ******************************************************* ; #include <IE.au3> $oIE = _IE_Example ("form") $oSubmit = _IEGetObjByName ($oIE, "submitExample") $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction ($oSubmit, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Orgins Posted May 30, 2008 Author Share Posted May 30, 2008 K got it working now. Thinks everyone for helping me (basically doing it for me). I'm a newbie.Sorry if I don't reposed to your replays very fast. 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