WatiNを使用すると、IEウィンドウの要素の「ネイティブ」インターフェースにアクセスできます。これを使用すると、任意の要素の画面座標を取得できます。
using mshtml; //Add a reference to Microsoft.mshtml that comes with WatiN.
using WatiN.Core.Native.InternetExplorer;
public static System.Drawing.Point GetScreenPoint(IEElement element)
{
IHTMLElement nativeElement = element.AsHtmlElement;
IHTMLElement2 offsetElement = (IHTMLElement2)nativeElement;
IHTMLRect clientRect = offsetElement.getBoundingClientRect();
IHTMLDocument2 doc = (IHTMLDocument2)nativeElement.document;
IHTMLWindow3 window = (IHTMLWindow3)doc.parentWindow;
int windowLeft = window.screenLeft;
int windowTop = window.screenTop;
int elementLeft = clientRect.left;
int elementTop = clientRect.top;
int width = nativeElement.offsetWidth;
int height = nativeElement.offsetHeight;
int clickX = windowLeft + elementLeft + (width / 2);
int clickY = windowTop + elementTop + (height / 2);
return new System.Drawing.Point(clickX, clickY);
}
それを使用するには:
Button myButton = browser.Button(Find.ById("myButton"));
System.Drawing.Point clickPoint = GetScreenPoint((IEElement)myButton.NativeElement);
MyClick(clickPoint);
明らかに、要素は表示されている必要があります。そのオフハンドをチェックする方法はわかりませんが、本体のscrollTop属性とscrollLeft属性を変更してスクロールできると思います。
実際にクリックを行う方法も必要ですが、おそらくすでにstackoverflowにその答えがあります。