watin

WatiN “Unable to cast COM object” exception

血红的双手。 提交于 2019-12-05 15:34:14
from time to time, my monitoring application dies for no obvious reason. It seems like "mshtml.HTMLDocument" resource isn't available. Anyone else experienced something similar? Thanks in advance. Error message: 14.04.2011 18:26:37 -> Test 1.2 (Subscriber type requests), error: Unable to cast COM object of type 'System.__ComObject' to interface type 'mshtml.HTMLDocument'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{3050F55F-98B5-11CF-BB82-00AA00BDCE0B}' failed due to the following error: No such interface supported (Exception from

How do I use the FileUploadDialogHandler in watin to access the file upload dialog

丶灬走出姿态 提交于 2019-12-05 13:57:20
I'm using IE8 with watin and am trying to test uploading a file via my webpage. I can't simply set the upload file using the set method like ie.FileUpload(Find.ById("someId")).Set("C:/Desktop/image.jpg"); because the upload textarea is not writeable in IE8, so I have to use the FileUploadDialogHandler but I can't find any examples of how to do this. I have found and used examples of the ConfirmDialogHandler successfully, but I can't seem to figure out how to use the FileUploadDialogHandler. Any examples would be greatly appreciated. Your code looks OK. You don't have to use

ASP.NET Unit Testing - WatiN and Windows 7 / Internet Explorer 8

可紊 提交于 2019-12-05 13:19:53
Any tricks in getting WatiN to run on Win7/IE8? My code: browser = new IE(); browser.GoTo("http://testserver"); browser.TextField(Find.ByName("txtUser")).TypeText("tyndall"); The third line never really runs and I get an error back: System.Runtime.InteropServices.COMException : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) The second line seems to run. IE8 appears and is navigated to the correct URL. Nick Josevski Reboot the machine There are windows updates getting in the way of instantiating new COM objects. See my answer on this question for more details: WatiN, NUnit

Test framework to replace Watin, if it would cease being maintained?

老子叫甜甜 提交于 2019-12-05 07:47:15
I had the impression that Watin was no longer being maintained and asked to which framework would be the best to switch to for testing of a website in a browser from .net? Back in July on the WatiN mailing list, Jeroen stated the following. ...is WatiN still alive: Yes. Is the activity visible for the outside world: No, which is a bad thing. During my holiday last two weeks I have been thinking about how to proceed and decided that I will work on WatiN every Thursday evening. Number one prio is get the updated FireFox support and IE improvements out asap. . If moving away from WatiN, then

WatiN: When finding text, how do I get a reference to its containing element?

谁说胖子不能爱 提交于 2019-12-05 06:04:48
Given the following HTML page: <html> <head> <title>WatiN Test</title> </head> <body> <div> <p>Hello World!</p> </div> </body> </html> I would like to be able to search for some text (lets say "World" ), and get a reference to its parent element (in this case the <p> element). If I try this: var element = ie.Element(Find.ByText(t => t.Contains("World"))) or this: var element = ie.Element(e => e.Text != null && e.Text.Contains("World")); I get back the <html> element. This is consistent with the WatiN documentation for Element.Text which states: "Gets the innertext of this element (and the

How to handle Windows Security alert dialog box using Watin IE

霸气de小男生 提交于 2019-12-05 05:31:41
I am trying to automate a website using WatIN IE. As the website bans the ip after few request .So I am setting a bool ipbanned =true when ip gets bannned. In that case and i wish to change the IP. The SetProxy method successfully changes the ip adress with port. but on next request I am getting this screen :- Note: - the first red strip shows the ip address and the second one shows the server name How should I set the username and password in this dialog box from within the program, so that user do not get to see this box and it is set correctly Below is the code snippet I am using:- private

How to find an Element in Watin by its tag name?

佐手、 提交于 2019-12-05 04:46:19
How to find a specific element, or a list of elements by using their TagName using Watin? Jeroen van Menen As of WatiN 2.0 beta 1 this has changed to: ie.ElementWithTag("h1", constraint); Constraints are created when using the Find.XXX methods. Here is an example: ie.ElementWithTag("h1", Find.ByClass("blue"); For example, to find the first <h1> on a page, use: ie.Element("h1", Find.ByIndex(0)) this is what worked for me: var element = ie.Element(x => x.Text == "[innerText]" && x.TagName == "[tagname]"); 来源: https://stackoverflow.com/questions/389066/how-to-find-an-element-in-watin-by-its-tag

Watin Windows Authentication

為{幸葍}努か 提交于 2019-12-05 01:23:29
问题 I am trying to write Watin tests for an intranet application that uses Integrated Authentication. The web page that I am trying to test prints Page.User.Identity.Name. Here is some of the code from my test: if (Win32.LogonUser(u.UserName, u.Domain, u.Password, 2 /*LOGON32_LOGON_INTERACTIVE*/, 0 /*LOGON32_PROVIDER_DEFAULT*/, out hToken)) { if (Win32.DuplicateToken(hToken, 2, out hTokenDuplicate)) { WindowsIdentity windowsIdentity = new WindowsIdentity(hTokenDuplicate);

Selenium locator for <label for=“x”>

偶尔善良 提交于 2019-12-05 00:51:59
With ASP.NET the tag IDs are pretty volatile so to make my tests more robust I want to locate elements by their label texts. I have played some with WatiN and it does this perfectly but that project seem kind of dead nowadays so I thought I'd look into Selenium as well before I decide on a framework. I have html that looks something like this <label for="ctl00_content_loginForm_ctl01_username">Username</label>: <input type="text" id="ctl00_content_loginForm_ctl01_username" /> I don't want to type: selenium.Type("ctl00_content_loginForm_ctl01_username", "xxx"); That is too reliant on the ID. In

Automate of file download in IE 11 using c#

二次信任 提交于 2019-12-04 16:49:36
I am trying to get the window handler and press the Save button. I found couple of examples on IE8 & 9. But that code doesn't works on IE 11. const int BM_CLICK = 0x00F5; [DllImport("user32.dll", SetLastError = true)] static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool SetForegroundWindow(IntPtr hWnd); [DllImport("user32.dll", SetLastError = true)] static extern IntPtr SetActiveWindow(IntPtr hWnd); [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern IntPtr FindWindowEx