tonycst Posted January 18, 2018 Share Posted January 18, 2018 I am trying to click inputbox. $IE = _IEAttach($WinTitle) _IELoadWait($IE) ;make sure loaded $IEObject = _IEGetObjByname($IE, "txtSearch") _IEAction($IEObject, "click") Nothing happens unless i click it with mouse. It ONLY works for buttons but not for an inputs and combo boxes. Maybe inputs and combos i try to click are none standard ? Here is a code from the page for the input. <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. thanks ! Link to comment Share on other sites More sharing options...
jdelaney Posted January 19, 2018 Share Posted January 19, 2018 (edited) Not enough info, so I'll take a stab in the dark...throw in this additional line: $IE = _IEAttach($WinTitle) _IELoadWait($IE) ;make sure loaded $IEObject = _IEGetObjByname($IE, "txtSearch") ; _IEAction($IEObject, "click") _IEAction($IEObject, "focus") ; now set the text, and then do a blur: _IEAction($IEObject, "blur") As for combo boxes, use this to set the value: _IEFormElementOptionSelect Edited January 19, 2018 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
tonycst Posted January 19, 2018 Author Share Posted January 19, 2018 I dont need to set any values, i just need the input box to be clicked. Focus worked, thank you. What i dont understand is why CLICK does not work but FOCUS does. No way i'd assume i need to focus on an element when i am trying to click it lol Link to comment Share on other sites More sharing options...
jdelaney Posted January 19, 2018 Share Posted January 19, 2018 You are assuming that the _IEaction "click" will do the same as a 'mouseclick' on a gui application...that is not a correct assumption. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
tonycst Posted January 19, 2018 Author Share Posted January 19, 2018 I dont know man. To me, click=click. Pretty sure in Africa click also means click with a mouse. Link to comment Share on other sites More sharing options...
Danp2 Posted January 19, 2018 Share Posted January 19, 2018 You need to ask yourself which event you are trying to trigger. If the goal is to trigger the onClick event, then use _IEAction with click. In this case, the code is in the onFocus event, so you need to give the element focus for that event to be triggered. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
tonycst Posted January 19, 2018 Author Share Posted January 19, 2018 I began to see what you mean, but that i need not only understand autoit but also how IE elements work. Why not say in the help file that "Focus" is more like a mouse click and "click" is more like (to be honest, i dont know what "click" would stand for other then a mouse click.) something else but clearly not the mouse click. ? That would clear the confusion for generations to come Link to comment Share on other sites More sharing options...
spudw2k Posted January 19, 2018 Share Posted January 19, 2018 15 minutes ago, tonycst said: Why not say in the help file that "Focus" is more like a mouse click and "click" is more like...something else but clearly not the mouse click. ? Because that is not accurate. Focus is like setting focus, while Click "simulates" a mouse click by firing the objects OnClick event. It would be more accurate for the help file to state this message which is on the MSDN page for the IHTMLElement Click method page Quote Remarks Note Simulating a click using the IHTMLElement::click does not bring the element being clicked into focus. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF 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