Jump to content
Sign in to follow this  
c.haslam

How to simulate a mouseclick on a web app in IE

Recommended Posts

c.haslam

I am using a manufacture's web app to enter data into his system. I have managed to get data entry into his form working OK, but now I need to print a report via his Print button. So far, I have been looking at MouseClick with MouseCoordMode set to window.

The script will be run on various PCs, some of which have a different display resolutions from mine. I am running 1024x768. I have tried a simple macro to get the x,y positions when the mouse is hovering over the i in Print on my PC and on another PC. MouseGetPos() returns the same x position on both PCs (mine at 1024x768 and the other at 1280x 800), but different y positions.

I do see that when IE is maximized, ypos1280 / ypos1024 = winheight1280 / winheight1024, but if IE is smaller than maximized, this relationship does not hold.

Can anyone point me to a method for calculating the ypos for various window sizes (and display resolutions)?

Or:

Is using _IEAction a better approach?


Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
Share on other sites
water

I would suggest to use the IE UDF. After reading your post I think _IEAction is the way to go.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
c.haslam

Thank you for your reply. Perhaps you can help me further.

I see Example 1 in the help for_IEGetObjByName():

Local $oIE = _IE_Example("form")

Local $oSubmit = _IEGetObjByName($oIE, "submitExample")

_IEAction($oSubmit, "click")

_IELoadWait($oIE)

I see, in the IE.au3 code, that "submitExample" is a name attribute.

But looking at the code in the page I see something similar to:

<a href="#" onclick="pPrint(document.form, aLoc)">Print</a>

You will see that the a href has no name attribute.

So how do I get a first parameter for _IEAction()?

(I have shortened the value of the onclick attribute because of commercial confidentiality.)


Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
Share on other sites
garbb

Could you try something simpler like _IELinkClickByText which will just click on a link based on the text?

Share this post


Link to post
Share on other sites
c.haslam

Many thanks. _IELinkClickByText works.

IE.au3 is amazing. Not surprisingly for such a large and powerful library, there is a fairly steep learning curve. I really appreciate your coaching.


Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

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  

×