Jump to content

How to simulate a mouseclick on a web app in IE


Recommended Posts

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

 

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...