watin

WatiN BrowserNotFoundException after upgrading to IE9

不问归期 提交于 2019-12-11 07:35:57
问题 I just upgraded my x64 Windows 7 machine to IE9 and now WatiN is throwing a BrowserNotFoundException when I do something like: IE ie = new IE(true); ie.GoTo("http://google.com"); I am using WatiN 2.1 and the latest code from SourceForge. The exact version of IE9 I'm running is 9.0.5. The browser window actually launches to "about:blank" but WatiN fails to find the newly launched browser. It appears WatiN finds the newly launched browser by comparing the main window handle of the launched

Change User Agent

随声附和 提交于 2019-12-11 07:02:00
问题 I am using Watin and i want to change User Agent can it be done in watin c#.Some websites say it is done by changing registries and some say that IE8 has addon to change that but i want to change it by programming 回答1: From your last comment I am not sure if you are familiar with registry classes. Here are some tutorials on accessing and modifying registry. Code project Dream in code C-sharpcorner Then you need to modify HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet

Getting around System.UnauthorizedAccessException : Access is denied

好久不见. 提交于 2019-12-11 06:59:51
问题 I am using Waitin RC2, WatiN-2.0.20.1089, Windows XP OS with IE8 With VS2008 and NUnit-2.5.7.10213. I have added the sites to the trusted list, I have thread sleeps, I have tried "WaitForComplete". yet when the script goes "back" I am still getting an unauthorized access exception. Here is a chunk of my code, the exceptions are never caught inspite of the fact that most of the code is in try catch blocks. public string FindAllLinks() { /* * This function is designed to find and use all of the

WatiN:How to use the automated test run result as I am unable to get the way of Reporting the result of the test run

允我心安 提交于 2019-12-11 06:18:53
问题 I have automated a module with WATIN and now I want the test result to be displayed as PASS/FAIL status etc(REPORTING), Is there any functionality in Watin to do my required action. Like I have a code like public static void TestSelectPatientLink() { try { Link lnkSelectPatientb = ie.Link(Find.ByTitle("Search patient")); lnkSelectPatientb.Blur(); lnkSelectPatientb.ClickNoWait(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } How to get the report as what happened when this

detect new browser window with WATIN

扶醉桌前 提交于 2019-12-11 06:17:58
问题 is there a way to test wether a link was opened in a new browser-window (or browser-tab)? Update: So far I used the following code: var newBrowserWindow = Browser.AttachTo<IE>(Find.ByTitle(browserTitle)); Assert.That(newBrowserWindow.hWnd, Is.Not.EqualTo(existingBrowserWindow.hWnd)); Where I used the existingBrowserWindow to open a page and to click on a link. But when the link opens a new tab in the existing browser (default behaviour for IE with targer=_blank) it has the same window-handle,

WatiN through TFS on Windows 2008 Server

China☆狼群 提交于 2019-12-11 02:59:15
问题 I'm trying to run WatiN tests through continuous build on TFS, but I can't get it to work. The errror I get is following: WatiN.Core.Exceptions.IENotFoundException : Could not find an IE window matching constraint: Timeout while waiting to attach to newly created instance of IE.. Search expired after '30' seconds. at WatiN.Core.IE.CreateIEPartiallyInitializedInNewProcess() at WatiN.Core.IE.CreateNewIEAndGoToUri(Uri uri, IDialogHandler logonDialogHandler, Boolean createInNewProcess) at WatiN

catch user activity within webbrowser or watin

笑着哭i 提交于 2019-12-11 02:51:18
问题 Is there any way to detect all the possible user activities within a WebBrowser and return a custom Event ? For example: User clicks on "search" button, return "SearchButtonClicked" custom Event . It would be something like, logging of all the activity that user does, stored in a sequence and could be automated once he wanted. Edit: I do not own the webpage. I am trying to make an application to automate some searching on google. 回答1: Wow, it's going to be quite a bandwidth intensive

WatiN can't find text after searching google

て烟熏妆下的殇ゞ 提交于 2019-12-11 02:18:59
问题 I'm trying to run a simple watiN example: search google then verify the search result. (on IE9) var browser = new IE("http://www.google.com/ncr"); browser.TextField(Find.ByName("q")).TypeText("WatiN"); browser.Button(Find.ByName("btnG")).Click(); Assert.True(browser.ContainsText("WatiN")); This test fails! I don't know why, but adding a call to WaitUntilContainsText("Everything") make this pass: var browser = new IE("http://www.google.com/ncr"); browser.TextField(Find.ByName("q")).TypeText(

WatiN File Upload

蹲街弑〆低调 提交于 2019-12-11 01:55:58
问题 I've hit a snag. I am trying to use WatiN to upload a file. I can load the upload box, but it quickly disappears. The last line of my code at the moment is: ie.FileUpload(Find.ById("profile_file")).Click(); It loads the dialog to select a picture but disappears. Is it possible to set the path of the box automatically example, load "C:/Desktop/image.jpg"? Also, is it possible to wait for the upload to complete before continuing? Help is much appreciated. Thanks. 回答1: This is 6 years late, but

WatiN generates empty pages

Deadly 提交于 2019-12-11 01:26:03
问题 When capturing images using WatiN the resulting images are just empty, solid black. The size of the images equals the screen size, though. For example the following snippet just saves two black images. using (IE ie = new IE()) { ie.ClearCache(); ie.BringToFront(); ie.GoTo("http://localhost/"); ie.CaptureWebPageToFile(imageDir + "\\localhost.png"); WatiN.Core.CaptureWebPage capture = new CaptureWebPage(ie); capture.CaptureWebPageToFile(imageDir + "\\localhost.jpg", true, true, 100, 80); Assert