watin

Get text from text field of type email?

删除回忆录丶 提交于 2019-12-14 02:26:23
问题 So I am trying to read a site with C#. I have it so it opens a website and goes to read a TextField. However the website has the text field like so. <input name="loginMail" class="c-txtfld c-txtfld-fixed c-txtfld-green c-txtfld-medium" id="login-email" type="email" placeholder="Email address" pattern="[^ @]*@[^ @]*"> And because of this I can get C# to read it. TextField emailaddressfield = this.Document.TextField(Find.BySelector("form#login-form.credential-form input#login-email") It will

WatiN ie9 confirm dialog is not working [duplicate]

扶醉桌前 提交于 2019-12-13 07:39:26
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Watin & IE9 - Cant click ok buttons var dialogHandler = new WatiN.Core.DialogHandlers.ConfirmDialogHandler(); using (new WatiN.Core.DialogHandlers.UseDialogOnce(browser.DialogWatcher, dialogHandler)) { browser.Button(Find.ById("btnSave")).ClickNoWait(); dialogHandler.WaitUntilExists(); } it's not working on ie 9, javascript confirm I already use latest version 2.1 回答1: ConfirmDialogHandler confirmHandler = new

UnauthorizedAccessException when redirecting to a new page with the error displayed on top

爱⌒轻易说出口 提交于 2019-12-13 07:08:56
问题 The app is at certain view with submenus at the left and a list of items in the main content area. The user needs to select an item before clicking on any of the submenu to navigate to the submenu pages. If no item is selected and a submenu is clicked, the server is supposed to post an error to MVC and redirect to the original list page with the error message displayed on top of the page. The test simply navigate to the list page, without selecting any item, immediately click on the submenu.

How to enable automatic downloads in IE11

假如想象 提交于 2019-12-13 05:02:03
问题 I using WatIn (IE11), i make click's on files then i have download dialog that shows,i need to start this download automaticly with out pressing saveAs button and typing the path. The reason is-- I have program that run's when my windows is lock and WatIn saveAs function need interactive UI sow it wont work. 回答1: I found a way to do this, but you need to use User32.dll sendmessage() function, after you press button\link and you have your download dialog i use sendmessage to send key's i send:

C# - How to detect if website return page with content “This page cannot be displayed ”using Watin?

ⅰ亾dé卋堺 提交于 2019-12-13 04:30:43
问题 I have a project about going to a website. If the website cannot be loaded, and the browser will show a page with text: "This page cannot be displayed" .In this situation, I want to auto refresh the browser. How will the program detect that website can't be loaded? . I've tried Ping() to check the connection, but it seems the connection is fine. Take a look at my below code: public void exam() { var ie = new IE(); ie.GoTo("http://search.yahoo.com"); ie.WaitForComplete(5); if (ie.ContainsText(

Error When making a loop to crawl Google next page Watin

跟風遠走 提交于 2019-12-13 02:59:46
问题 I have a simple code that help me crawl to page 2 of Google result page: var ie= new IE(); ie.Link(Find.ByText("2")).Click(); All I want is crawling to more next page with the inputed number of page, so that I make a loop like this: string[] page = null; for (int i = 0; i < NumOfPage; i++) { Array.Resize<string> (ref page, i+1); page[i] = "\"" + i.ToString() + "\""; } int count=2; while (count<NumOfPage) { ie.Link(Find.ByText(page[count])).Click(); count++; } But the result is it pause at the

Windows Logon Dialog by Watin

半腔热情 提交于 2019-12-13 00:56:50
问题 We have an automation test running on IE using WatiN. This test requires handling the logon dialog. How I should process it by Watin? 回答1: In Windows 7, the Logon handler became a WPF component and no longer a part of the IE. I think this even applies to IE8 or higher already. Below is the code we use for handeling these dialogs. It's something I wrote myself, so feel free to use it, as long as credit is given where due. using System.Windows.Automation; using System.Linq; using WatiN.Core

Having problems running WatiN on Windows 7 with IE 8

那年仲夏 提交于 2019-12-12 20:08:13
问题 When I run any WatiN test on Windows 7 with IE8(note that all tests pass on Vista with IE8), the browser displays the first page but does not go any further. The following exception is displayed after a few seconds: WatiN.Core.Exceptions.TimeoutException: Timeout while Internet Explorer state not complete at WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.ThrowTimeOutException(Exception lastException, String message) at WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.HandleTimeOut() at WatiN.Core

Shared Unit Tests with MSTest

北慕城南 提交于 2019-12-12 18:35:27
问题 I have approximately 5-6 reports, they are structured the same, using Watin, I'm testing each one of these reports. I have a shared test, I call "ReportBaseTests".. public class ReportBaseTests { public string MenuName { get; set; } public ReportBaseTests(string name) { this.MenuName = name; } [TestMethod] public void Perform_Invalid_Date_Range() { } } but in each of my tests, I have... [TestClass] public class Report1Tests : ReportBaseTests { public Report1Tests() : base("Report 1") { } }

NUnit TestContext.CurrentContext null reference exception

五迷三道 提交于 2019-12-12 11:38:26
问题 I've been playing around this morning with watiN / Nunit to capture a screenshot on failed UI tests. However, I'm running into NRE's when accessing Nunits TestContext.CurrentContext... Any ideas as to what I'm doing wrong? [TestFixture] class SomePageTest { [Test] [STAThread] public void Page_IsAvailable() { var browser = new SomePage(); Assert.IsTrue(browser.ContainsText("Something")); if (TestContext.CurrentContext.Result.Status == TestStatus.Failed) { browser.CaptureWebPageToFile(@"X: