watin

Can I read JavaScript alert box with WatiN?

大憨熊 提交于 2019-12-03 05:58:50
I want to use WatiN to verify the error message in a JavaScript alert box. Is this possible? Thanks. Dror see Trev's Blog and here as well. using(IE ie = new IE("http://hostname/pagename.htm")) { AlertDialogHandler alertDialogHandler = new AlertDialogHandler(); using (new UseDialogOnce(ie.DialogWatcher, alertDialogHandler )) { /************************************* * -- alert -- * * * * must use the "NoWait" to allow * * the code to goto the next line * * * *************************************/ alertDialogHandler.WaitUntilExists(); alertDialogHandler.OKButton.Click(); ie.WaitForComplete(); }

In WatiN how to wait until postback is complete

不想你离开。 提交于 2019-12-03 03:30:30
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(); 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 You could check if IE is busy rather than complete. while (((SHDocVw.InternetExplorerClass)(_ie

Silverlight testing: Watin vs Selenium comparison

本秂侑毒 提交于 2019-12-02 23:45:46
I was wondering how well these web test frameworks (Watin and Selenium) work for Silverlight UI testing. Have anyone tried it on a project? Are Watin or Selenium well suited for Silverlight?. Brian Genisio I can't talk to Watin or Selenium with Silverlight, but I have played with White , which is a layer on top of the MS Automation Framework, and I have liked what I have seen thus far: I should also add that we defer the majority of our UI behavior testing to unit tests using the MVVM pattern. It doesn't test EVERYTHING, but it gets us 95% of the way there. Functional testing frameworks like

Click on Save or SaveAs dialog of file download

时间秒杀一切 提交于 2019-12-02 21:52:55
问题 I have seen couple of question posted on this topic but none of the solution worked that's why I am posting it again. I am using WatIn to automate the testing of my website. Using IE 11. I have to download and save the file, but I am not able to click the save or saveas button of the download window. I tried FileDownloadHandler of WatIn but it didn't worked. I am not limited to WatIn only solutions. It could be anything thing which I can use in my C# code will be acceptable

Click on Save or SaveAs dialog of file download

删除回忆录丶 提交于 2019-12-02 09:40:19
I have seen couple of question posted on this topic but none of the solution worked that's why I am posting it again. I am using WatIn to automate the testing of my website. Using IE 11. I have to download and save the file, but I am not able to click the save or saveas button of the download window. I tried FileDownloadHandler of WatIn but it didn't worked. I am not limited to WatIn only solutions. It could be anything thing which I can use in my C# code will be acceptable FileDownloadHandler fileDownloadHandler = new FileDownloadHandler(); browser.AddDialogHandler(fileDownloadHandler);

how to wait until the textbox enable in watin

感情迁移 提交于 2019-12-02 09:29:34
i have one textbox on my page on the load event textbox is disable for 10 then its enable so how to wait for 10 sec in watin. i am try to this code IE ie = new IE("http://localhost:2034/WebForm3.aspx"); ie.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Maximize); ie.TextField("TextBox1").TypeText("Fer"); but it gives the error that TextBox1 is disable so i want to wait for some time. so how to do this? please help me? You can just sleep the thread for a fixed amount of time in order for the test to wait: System.Threading.Thread.Sleep(10000); The time is in milliseconds.

How to fill a specific input field with WatiN, when multiple inputs have the same “Name”?

陌路散爱 提交于 2019-12-02 02:10:49
问题 I'm using WatiN and C# to fill out a form online but my Search field has the same name as another element. My search field is defined as follows: <input type="text" value="" size="50" name="search"> There is also a different search field in another section of the same screen defined as: <input class="Search-TextBox" type="text" value="" size="15" name="search"> I want to fill out the formerly mentioned text input search field. Is there a way to find and fill the search box based on size maybe

How to check if PDF was successfully opened in the browser using WatiN?

非 Y 不嫁゛ 提交于 2019-12-01 19:07:40
I am using WatiN library to do a quick smoke test on a web site after deployment. Among other things, I want to make sure that when I click on a specific link on my page, a PDF is opened in the browser. Clicking the link is easy, but how can I detect if Acrobat Reader was successfully opened in the browser window? I would like to catch situations like 404, server errors, or time-outs... MoMo Rub, I found one bug report and one feature request on this issue. Both the bug and feature request are closed but I am still not able to attach to a IE window that is hosting a PDF document. In fact the

How can I ensure that I dispose of an object in my singleton before the application closes?

血红的双手。 提交于 2019-12-01 19:02:37
I'm using WatiN for some automated tests and what I found was that creating an IE instance for every test was not scalable. The creation and shutdown time of each IE instance was eating me alive: [TestMethod] public void Verify_Some_Useful_Thing() { using (var browser = new IE()) { browser.GoTo("/someurl"); // etc.. // some assert() statements } } However, the using statement did prove useful in that I can always ensure that my IE instance would have its dispose() method called which would close the IE window. Anyway, I created a singleton which maintained a single IE instance which all my

How can I ensure that I dispose of an object in my singleton before the application closes?

喜欢而已 提交于 2019-12-01 18:14:28
问题 I'm using WatiN for some automated tests and what I found was that creating an IE instance for every test was not scalable. The creation and shutdown time of each IE instance was eating me alive: [TestMethod] public void Verify_Some_Useful_Thing() { using (var browser = new IE()) { browser.GoTo("/someurl"); // etc.. // some assert() statements } } However, the using statement did prove useful in that I can always ensure that my IE instance would have its dispose() method called which would