This post describes a simple technique that can enable retrieval of a Link’s onMouseOver color. The only trick is to change the ReplayType setting to Mouse Events while firing an onMouseOver event on the link. Changing the event cause an actual FireEvent action, that you would encounter when you hover the mouse on the link manually.
Below, you will see that the hover event is triggered with the ReplayType set to Mouse Events:
Setting.WebPackage("ReplayType") = 2 Browser("Browser").Link("Link").FireEvent "onMouseOver" MsgBox Browser("Browser").Link("Link").Object.currentStyle.color Setting.WebPackage("ReplayType") = 1
The above snippet can be simplified and be reused using the function below:
Function GetHoverColor(oLink) Setting.WebPackage("ReplayType") = 2 oLink.FireEvent "onMouseOver" GetHoverColor = oLink.Object.currentStyle.color Setting.WebPackage("ReplayType") = 1 End Function RegisterUserFunc "Link", "GetHoverColor", "GetHoverColor"
Now, whenever the link color is to be retrieved, you can simply call the “GetHoverColor” function as you would normally use the Click event:
MsgBox Browser("Browser").Page("Page").Link("Link").GetHoverColor
I hope you find this useful.
FaceBook
LinkedIn
Twitter
YouTube
{ 10 comments… read them below or add one }
Hi Anshoo,
Today i go through from Your blog in goggle search.
realy you are doing great job.
keep it up
Thank you, Rajiv. I hope you like reading the articles here :)
Simple neat and very nice….
Glad you liked it, Selvam :)
Its really nice. Can you please share few articles related to the below problem.
when I fire a mouseover event, I get a complete structure of a table. how to retrive the data from this. Can you Please share this info. thank u
Hi Rajesh,
I’m not sure if I understand the scenario quite well. The table structure is retrieved when you onMouseOver it? What data are you trying to retrieve from the table? If possible, could you attach or e-mail me the HTML source of the document?
My email is
anshoo.arora [at] relevantcodes.comThank you
Anshoo
The problem is now resolved. I learned the Table and is working good.
Great! :)
Great articles…. Keep it up
Thanks Raj :)