PDA

View Full Version : Simulating mouse click on web page



ashyankee
05-10-2010, 11:38 PM
Im trying to automate a webpage which has a table built with some grid. The user has to click on the a cell in the table to display another table in the right side of the page. I can access the cells in the table but i couldnt fire the click event on the cells. I already made a thread on this but nobody replied except one. Since firing the mouse click event didnt work i thought of setting focus on that cell and generating a mouse click. Does anyone have any idea how to do this? I searched in other forums but it seems theres no way to generate a mouse click unless i use API??? I dont know much about this API. Any suggestion will be helpful :bow:

Crocus Crow
05-11-2010, 03:06 PM
If by 'API' you mean the HTML Object Library, then something like this sets the focus on a cell and clicks it (obviously you'll have to change the Set cell line so that it references the correct cell element):

Sub xx()
Dim cell As HTMLTableCell
Set cell = ie.document....the cell
cell.Focus
cell.Click
End SubBut why start a new thread on the same problem? Keep everything in one thread and then people can easily see how far you've got and what you've tried.

In your other thread - h ttp://w ww.vbaexpress.com/forum/showthread.php?t=31798 - post the complete HTML source, not just a snippet, plus the Javascript source code of any included .js files

ashyankee
05-12-2010, 01:28 AM
I tried the method you said but it still doesnt work.. I tried firing onclick,onmouseup,ondblclick events on the cell but no luck. And one more thing.. There are checkboxes in every cell. Does this mean this is a different kind of table which cant be accessed? I can access the innertext in that cell but only this clicking thing doesnt work.