elads Posted September 14, 2009 Share Posted September 14, 2009 (edited) Hey, I would like to click on a button after i'm logged to my system (web). Here's the scenrario: $oIE = _IECreate("http://www.somesite.com") $oform = _IEFormGetObjByName($oIE, "start-login-form") $ologin = _IEFormElementGetObjByName($oform, "Email") ; Email $opassword = _IEFormElementGetObjByName($oform, "Passwd") ; Passwd _IEFormElementSetValue($ologin, $sUsername) _IEFormElementSetValue($opassword, $sPassword) _IEFormSubmit($oform) So far so good... Now after i've logged in, I want to click on a button/link on that page. What's the right command and how do i use it? Thanks Edited September 14, 2009 by elads Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 14, 2009 Share Posted September 14, 2009 Hey, I would like to click on a button after i'm logged to my system (web). Here's the scenrario: $oIE = _IECreate("http://www.somesite.com") $oform = _IEFormGetObjByName($oIE, "start-login-form") $ologin = _IEFormElementGetObjByName($oform, "Email") ; Email $opassword = _IEFormElementGetObjByName($oform, "Passwd") ; Passwd _IEFormElementSetValue($ologin, $sUsername) _IEFormElementSetValue($opassword, $sPassword) _IEFormSubmit($oform) So far so good... Now after i've logged in, I want to click on a button/link on that page. What's the right command and how do i use it? Thanks After you read the help file (You did read the help file, right?), and you tried the example scripts for the _IE* functions (You did try the examples, right?), what did you finally test and how it turn out? 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...
elads Posted September 15, 2009 Author Share Posted September 15, 2009 (edited) After you read the help file (You did read the help file, right?), and you tried the example scripts for the _IE* functions (You did try the examples, right?), what did you finally test and how it turn out? Yes I did... tried this right after: _IEGetObjByName ($oButton, "button I want to click on") _IEAction ($oButton, "click") "button I want to click on" is a button that appears in that web page that opens, and that's what I want to click on... As for the outcome, the page opens ok and the sign-in part is good. but after that nothing happens Edited September 15, 2009 by elads Link to comment Share on other sites More sharing options...
jvanegmond Posted September 15, 2009 Share Posted September 15, 2009 And what does the SciTe output say? github.com/jvanegmond Link to comment Share on other sites More sharing options...
elads Posted September 15, 2009 Author Share Posted September 15, 2009 And what does the SciTe output say?Nothing.. the script is paused and that's it Link to comment Share on other sites More sharing options...
jvanegmond Posted September 15, 2009 Share Posted September 15, 2009 (edited) I don't think the part that you think you have problems with is actually the problem. It's more like that a few lines of code just before it are causing trouble. These two functions: _IEGetObjByName and _IEAction are almost instant. There is no waiting inside, or anything. Let me demonstrate by giving some bad input into them: #include <IE.au3> $oButton = "NOT AN OBJECT" _IEGetObjByName ($oButton, "button I want to click on") _IEAction ($oButton, "click") Result: >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Jos\Desktop\lol.au3" --> IE.au3 V2.4-0 Error from function _IEGetObjByName, $_IEStatus_InvalidDataType --> IE.au3 V2.4-0 Error from function _IEAction, $_IEStatus_InvalidDataType >Exit code: 0 Time: 0.209 Edited September 15, 2009 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 15, 2009 Share Posted September 15, 2009 Yes I did... tried this right after: _IEGetObjByName ($oButton, "button I want to click on") _IEAction ($oButton, "click") "button I want to click on" is a button that appears in that web page that opens, and that's what I want to click on... As for the outcome, the page opens ok and the sign-in part is good. but after that nothing happens Look again at _IEGetObjbyName() in the help file. The first parameter is $oIE or $oForm, etc., the PARENT object that has the one you are looking for under it. The second parameter is the button name (or ID, which is more reliable) in the HTML. So that should look more like: $oButton = _IEGetObjByName($oIE, "ButtonName") _IEAction($oButton, "click") 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...
jvanegmond Posted September 15, 2009 Share Posted September 15, 2009 I am giving some additional help through PM. There was some confidential information in his code, so he wanted to do it in private. github.com/jvanegmond Link to comment Share on other sites More sharing options...
tonycst Posted January 18, 2018 Share Posted January 18, 2018 (edited) I too have this problem but not with the button. I am trying to click inputbox. $IE = _IEAttach($AssemblyWindow) $PageLoadDone = _IELoadWait($IE) $IEObject = _IEGetObjByname($IE, "txtSearch") _IEAction($IEObject, "click") Nothing happens unless i click it with mouse. It ONLY works for buttons but not for a=inputs and combo boxes. Maybe inputs and combos i try to click are none standard ? <INPUT onkeypress=ValidationForCatalogandInventoryText();CheckScan(); onkeyup=EnableSearchButton(); onfocus=RemoveScanText(this.id); onblur=SystemSettingsTrim();SetScanText(false); id=txtSearch class=textbox onpaste=EnableSearchButton();OnPasteDisallowSpecialChars(); style="BACKGROUND-COLOR: white" ondrop="OnDragDropDisallowSpecialChars('btnSearch');" maxLength=15 value="Scan an item ..." name=txtSearch> Thats where i want to click. Edited January 18, 2018 by tonycst Link to comment Share on other sites More sharing options...
Danp2 Posted January 18, 2018 Share Posted January 18, 2018 Suggest that you start a new thread as there probably are not too many folks monitoring this one from eight years ago. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
tonycst Posted January 18, 2018 Share Posted January 18, 2018 8 years yet i landed here when i was searching for answers. I think its best to keep adding to the thread VS creating new once containing same information over and over and over again, cluttering sql database. But what do i know. Ill do what you say. 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