[Watin-users] Moving mouse over an element
Brought to you by:
jvmenen
|
From: Dmitry D. <dmi...@ma...> - 2007-11-23 11:02:26
|
Hi to all
Does anyone have a success in defining of an absolute position of an
element. It is need in order to move mouse on that element.
The only idea I have is to use a code like
public static Point GetXY(Element element)
{
Assert.ArgumentNotNull(element, "element");
IHTMLElement pos = (IHTMLElement)element.HTMLElement;
int x = 0;
int y = 0;
while (pos.offsetParent != null)
{
x += pos.offsetLeft;
y += pos.offsetTop;
pos = pos.offsetParent;
}
if(pos is HTMLBodyClass)
{
IHTMLWindow2 parentWindow =
((HTMLDocumentClass)((HTMLBodyClass)pos).ownerDocument).parentWindow;
// I don't know how to do that but it seems to get a handle of
'parentWindow'
// and though it get a window offset
// ???????
}
return new Point(x, y);
}
And the other question: is it possible to emulate dragging without knowing
the real coordinates?
Thanks in advance
Best Regards,
Dmitry Dzygin
|