PinetSebastien Posted October 9, 2014 Share Posted October 9, 2014 Hi, I'm trying to automate a well known web based ticket System called HPSM. My company has a "home" version of it. The HTLM page uses JavaScript. Here is a little snippet of the code : #include <IE.au3> Local $oIE = _IEAttach("Service") Local $oSubmit = _IEGetObjById($oIE, "cwc_masthead_logout_link") _IEAction($oSubmit, "click") _IELoadWait($oIE) This code basically clicks on the field right next to the big RED arrow on the image below. So that works fine. Because as you can see, the ID of the field is : cwc_masthead_logout_link. But when I try to click anywhere else on the page, it seems like no other fields seems to work. I'm guessing it's probably because the page uses frames? Here on the picute, you can see under the blue arrow, we have another field , with the id X314. I try clicking on this one with the exact same code as before, but I just change the ID. Here is the error I get : --> IE.au3 T3.0-1 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (x314) --> IE.au3 T3.0-1 Error from function _IEAction(click), $_IESTATUS_InvalidDataType Why is this happening? Link to comment Share on other sites More sharing options...
Danp2 Posted October 9, 2014 Share Posted October 9, 2014 But when I try to click anywhere else on the page, it seems like no other fields seems to work. I'm guessing it's probably because the page uses frames? You need to determine if there are frames in use. Look at the sample code related to _IEFrameGetCollection in the help file and use a modified version of this to assist you in determining the answer. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
PinetSebastien Posted October 10, 2014 Author Share Posted October 10, 2014 The page has 4 frames from what I can see. Anyway I can click on something inside a frame? Link to comment Share on other sites More sharing options...
MikahS Posted October 10, 2014 Share Posted October 10, 2014 Maybe using _IEFormGetObjByName() _IEAction() ; param 'click' to click on specific element. PinetSebastien 1 Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Solution Danp2 Posted October 10, 2014 Solution Share Posted October 10, 2014 The page has 4 frames from what I can see. Anyway I can click on something inside a frame? Sure. First you need to get a reference to the frame containing the desired elements using either _IEFrameGetCollection or _IEFrameGetObjByName. Then use this frame reference in place of your standard $oIE reference in your call to _IEGetObjById. For example: #include <IE.au3> Local $oIE = _IEAttach("Service") Local $oFrame = _IEFrameGetObjByName($oIE, "iFrame2") ; retrieve frame named "iFrame2" Local $oElement = _IEGetObjById($oFrame, "X314") PinetSebastien 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
PinetSebastien Posted October 10, 2014 Author Share Posted October 10, 2014 (edited) Sounds like what i`m looking for, i`ll work on that. Thank you Based Danp2 EDIT : Seems to be working all good now. Thx again Edited October 10, 2014 by PinetSebastien 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