watin

Login in a Webpage with Watin

不羁的心 提交于 2019-12-11 00:25:54
问题 I try to login on a webpage. On the webpage are two forms with inputs, the inputs have the same Id("username"). How can i get the right inputs to set my text? This is my wrong Code: browser.TextField(Find.ByName("username")).TypeText("test123"); or browser.Form(Find.ByName("form_login")).TextField(Find.ByName("username")).TypeText("test123"); 回答1: You can collect all text field in the page and then perform the action on the first or second appearance of the desired id. For example:

Watin - Submit button remain disabled after filling form

南笙酒味 提交于 2019-12-10 23:14:11
问题 I have a website which I need to login to automatically. I am trying to use Watin .NET library in order to do that. When I fill out the user name and password fields using Watin, the sumbit button remains disabled. I tried applying many events on the other fields (KeyPress, KeyDown, KeyUp, Tab, Enter...) Nothing worked. Pardon me for finding the button by value, but this is the only way that I found that worked. var field = ie.TextField(Find.ByName("userName")); field.TypeText("username");

Randomly throwing “InvalidCastException” during tests

為{幸葍}努か 提交于 2019-12-10 23:13:52
问题 On WatiN UI tests, I'm having an issue where when running tests, an error will sometimes will throw the following error: InvalidCastException was unhandled by user code" ... "Unable to cast COM object of type 'mshtml.HTMLDocumentClass' to interface type 'mshtml.IHTMLDocument2'. This operation failed because the QueryInterface call on the COM component for the interface with IID" ... "failed due to the following error. No such interface supported". It doesn't appear to matter whether WatiN is

Attaching WatiN to Firefox

烂漫一生 提交于 2019-12-10 20:20:30
问题 Using WatiN, Im facing some issues with FireFox FF = new FireFox ("http://www.google.com"); , FireFox always crashes at this point and VS report : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host any idea why this is happening ? Win7 32Bit - VS2008 - .NET 3.5 - Firefox 3.5 - WatiN-2.0.10.928-net-2.0 回答1: The jssh that comes with Watin CTP has an issue with FireFox 3.5. I downloaded Swat (Simple Web Automation Toolkit -

WatiN UnauthorizedAccessException errors

你说的曾经没有我的故事 提交于 2019-12-10 11:27:43
问题 I am getting UnauthorizedAccessException errros when running any tests using NUnit and WatiN: Test Test.IndexTests.Can_Do' failed: WatiN.Core.Exceptions.ElementNotFoundException : Could not find INPUT (hidden) or INPUT (password) or INPUT (text) or INPUT (textarea) or TEXTAREA element tag matching criteria: Attribute 'name' equals 'q' at http://www.google.com/ (inner exception: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))) ----> System.UnauthorizedAccessException :

Selenium locator for <label for=“x”>

混江龙づ霸主 提交于 2019-12-10 01:47:45
问题 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

In WatiN how to wait until postback is complete

人盡茶涼 提交于 2019-12-09 05:01:28
问题 in WatiN how can I wait until postback is complete. For example: // Postback response modifies update panel elsewhere on page browser.Text("id").TypeText("asd"); // WatiN doesn't wait until postback is completed (what code should I replace it with?). browser.WaitUntilComplete(); 回答1: WaitUntilComplete doesn't recognize ajax calls. See this article (search on WaitForAsyncPostBackToComplete) on how to inject some code to make that work as well: WatiN, Ajax and some Extension Methods HTH, Jeroen

Unable to load <mytest> because it is not located under Appbase

こ雲淡風輕ζ 提交于 2019-12-08 16:39:30
问题 I have created an NUnit project (NunitLoginTest.nunit) by selcting my test project in the nunit\bin directory and now I am trying to load that project, but it is giving me the following error. Unable to load Because it is not located under Appbase, could not load file or assembly "nunitLogintest" or one of its dependencies. The system cannot find the specified path What is it related to? I have also checked my configuration file. I am running this from console. Update: I want to start NUnit,

Show IE “Save As” dialog using Watin

二次信任 提交于 2019-12-08 13:20:30
问题 Has anybody has done this? Navigating to a web page and pop up the save as dialog? In this way, the browser can handle the file type, html, pdf, etc... 回答1: Do you need to this to be when a FileHandler is called or on a static webpage? If it is on a Handler page where the content type is returned then according the latest WatiN release documentation then you can do as follows: using(IE ie = new IE(someUrlToGoTo)) { FileDownloadHandler fileDownloadHandler = new FileDownloadHandler(fullFileName

Waiting for page to be fully loaded using WatiN

故事扮演 提交于 2019-12-08 12:27:10
问题 I have two questions related to the same problem... Q1 ) I am using WatiN(3.5) for automation of a website. The situation is that I want to obtain a div tag when the result page is fully loaded but WatiN don't wait for that page to be campletely loaded and tries to obatin that div which results in getting div with null. This div is populated by AJAX. This is th code that I am using to avoid that error but it does not work. while (resultDiv == null) { browser.Div("ui-tabs-1").WaitUntilExists()