Jump to content

Can I Add an EventHandler for a WebElement in a WebPage?


Zohar
 Share

Recommended Posts

Hi

 

Imagine this scenario:

There is a webpage that you did not create, and it is hosted somewhere on the internet.

That web page has 1 table, with 1 column and 10 rows.

In each row(which is one cell) there is some simple text.

The page doesn't do anything, just display these words.

 

Now, I want to add an OnClick event handler for each cell in that table,

so when a cell is clicked, then for example a MsgBox will appear, showing the content of the cell.

 

Can I do it with AutoIt?

I mean to add this eventhandler to the webpage, without saving it to disk and then editing the file myself..

 

Thank you

Edited by Zohar
Link to comment
Share on other sites

  • Moderators

Yes, he's talking about inserting javascript into the header.  You can obviously do that, but still be responsible to manage the code anyway in autoit (I assume that's what you want to do asking here).

I'm talking about catching the html events from AutoIt itself.  I believe there's an example in help on it, if not, plenty on the forum if you just type in objevent + IE in google.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I'm talking about catching the html events from AutoIt itself.  I believe there's an example in help on it, if not, plenty on the forum if you just type in objevent + IE in google.

 

For some reason I cannot find one, when using google with site:autoitscript.com

I did find the example in the help file, it's on the ObjEvent page.

From what I see there, ObjEvent can catch events that are related to the IE Browser control (for example ProgressChange),

but not events that happen in the webpage that the IE Browser control is running (for example a Button element being clicked..)

Am I correct or there's more info regarding it?

Edited by Zohar
Link to comment
Share on other sites

  • Moderators

Details:

UDF Example:

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Thank you SmOke_N,

I viewed it now, but I must admit that because it looks so long, it's a bit intimidating, so I think I will skip this option.

 

I managed to do it via Chimp's method, for a Button element.

I will try now to do it for a Table element too..

 

Thank you both

Link to comment
Share on other sites

  • Moderators

Thank you SmOke_N,

I viewed it now, but I must admit that because it looks so long, it's a bit intimidating, so I think I will skip this option.

Maybe this could help you and others in future endeavors.

>HTMLDocumentEvents UDF

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...