Example-Code:
(How to operate Control?) | HtmlInputButton submit = new
HtmlInputButton(htmlDoc); submit.SearchProperties[HtmlInputButton.PropertyNames.Class] = "SearchButton"; Mouse.Click(submit); | var hhName = ie.Div(Find.ByClass("HighlightedHeader")).Name;var linkUrl = ie.Link(Find.ById("testlinkid")).Url;
var checkbox = ie.CheckBox(Find.ByLabelText("User Name:"));
var checkbox = ie.CheckBox(Find.ByLabelText(new Regex("^User")));var linkUrl = ie.Link(Find.ByName("testlinkname")).Url; |
Example-Code:
(How to drag Control?) | Mouse.startDragging(submit); Mouse.stopDragging(0,40); | I don’t know how to realize it. |
Example-Code:
(How to handle Dialog?) | BrowserWindow bw = BrowserWindow.Launch("http://msdn.microsoft.com/en-us/library/system.xml(printer)"); WinWindow popupWindow = new
WinWindow(); popupWindow.SearchProperties[WinWindow.PropertyNames.Name] = "Print"; WinButton cancelButton = new
WinButton(popupWindow); cancelButton.SearchProperties[WinButton.PropertyNames.Name] = "Cancel"; Mouse.Click(cancelButton); bw.Close(); | using (var ie = new IE(new Uri("http://msdn.microsoft.com/en-us/library/system.xml(classic).aspx")))
{
ie.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Show);
WatiN.Core.DialogHandlers.ConfirmDialogHandler dh = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();
ie.AddDialogHandler(dh);
ie.Button(Find.ById("ctl00_ib1_hlFav")).ClickNoWait();
dh.WaitUntilExists(3);
dh.OKButton.Click();
ie.RemoveDialogHandler(dh);
}
|
Example-Code: (How to clear cookie/Cache) | BrowserWindow.ClearCache(); BrowserWindow.ClearCookies(); | // Clear the cache and cookies. IE ie = new IE(); ie.ClearCache(); ie.ClearCookies(); // Then go to the site and sign in. ie.GoTo("http://www.example.com/"); ie.Link(Find.ByText("Sign In")).Click();
//***************************Other example*********************************
// Clear cookies first.IE ie = new IE();ie.ClearCookies("http://www.example.com/"); // Then go to the site and sign in.ie.GoTo("http://www.example.com/");ie.Link(Find.ByText("Sign In")).Click(); |