Sign in to follow this  
Followers 0
PinetSebastien

Need some help with _IE functions and JavaScript.

6 posts in this topic

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. 

ELh8S1B.jpg?1

 

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?

Share this post


Link to post
Share on other sites



 

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.

Share this post


Link to post
Share on other sites

The page has 4 frames from what I can see. Anyway I can click on something inside a frame?

Share this post


Link to post
Share on other sites

Maybe using

_IEFormGetObjByName()
_IEAction() ; param 'click' to click on specific element.
1 person likes this

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My 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

 

Share this post


Link to post
Share on other sites

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")
1 person likes this

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by PinetSebastien

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0