Tuesday, January 31, 2012

HP QTP, Click LInk in specified cells in the data grid of siliverlight, SlvTable

SlvTable has the click method, by the x, y has to be the position relative to the parent control (table or the grid here.)

so , get the top location of the table itself, then run some basic math cacaluation, you can click any cells with links,

Here is one snippet to click [3,3] links,

myx=browser("HomePage).Page("Module1").SlvWindow("RootVisualWrapper").SlvTable("Grid1").GetCellProperty(3,3,"x")
myy=browser("HomePage).Page("Module1").SlvWindow("RootVisualWrapper").SlvTable("Grid1").GetCellProperty(3,3,"y")

parentx=browser("HomePage).Page("Module1").SlvWindow("RootVisualWrapper").SlvTable("Grid1").GetROProperty("x")
parenty=browser("HomePage).Page("Module1").SlvWindow("RootVisualWrapper").SlvTable("Grid1").GetROProperty("y")

w=browser("HomePage).Page("Module1").SlvWindow("RootVisualWrapper").SlvTable("Grid1").GetCellProperty(3,3,"width")
h=browser("HomePage).Page("Module1").SlvWindow("RootVisualWrapper").SlvTable("Grid1").GetCellProperty(3,3,"height")
 

rx=myx + w/2-parentx
ry=myy + h/2-parenty

browser("HomePage).Page("Module1").SlvWindow("RootVisualWrapper").SlvTable("Grid1").Click rx, ry

No comments:

 
Locations of visitors to this page