Sign in to follow this  
Followers 0
Zohar

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

10 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



have a look to the _IEHeadInsertEventScript() function


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

ObjEvent


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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Chimp:

Thank you, I will check it.

 

SmOke_N:

Is what you wrote different than Chimp's method?

Edited by Zohar

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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.

Share this post


Link to post
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

Share this post


Link to post
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.

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.

Share this post


Link to post
Share on other sites

Thank you SmOke_N,

I will read it now

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