Site Loader
Auckland, New Zealand
In the last post we discussed how to write a super simple code with Coypu for Selenium with C#, in this post we will discuss how to work with popup windows using Coypu for Selenium with C#. Here are some of the difference between Selenium from coypu Here is the complete video of the above discussion Here is the complete code from the above video
      [TestMethod]
        public void Test_PopupWindow()
        {
            var sessionConfiguration = new SessionConfiguration()
            {
                Browser = Browser.Firefox,
                AppHost = "executeautomation.com",
            };

            var browser = new BrowserSession(sessionConfiguration);
            browser.Visit("/demosite/Login.html");

            browser.FillIn("UserName").With("admin");
            browser.FillIn("Password").With("password");
            browser.ClickButton("Login");


            browser.ClickLink("HtmlPopup");

            //Switch to window
            var popup = browser.FindWindow("Popup Window", Options.Substring);
            //Select title
            popup.Select("Ms.").From("TitleId");
            //Type Initial
            popup.FillIn("Initial").With("KK");
            //First Name
            popup.FillIn("FirstName").With("Karthik");
            //Middle Name
            popup.FillIn("MiddleName").With("Mi");
            //Gender
            popup.Choose("female");

            //Close the window
            popup.ExecuteScript("self.close();");

            browser.FindWindow("Execute Automation");
            //Select title
            browser.Select("Ms.").From("TitleId");

        }
Thanks for reading the post and watching the video!!! Please leave your comments and let me know if there is anything I should update in this post. Thanks, Karthik KK

Post Author: Karthik kk

2 Replies to “Working with popup windows using Coypu for Selenium C#”

  1. Hi Karthik,
    Can you confirm which firefox version are you using. I am using 44.0.1 and test fails with a message:System.componentmodel.win32Exception. System cannot find the file specified. I have also set the path to the firefox installer but no luck.

Leave a Reply to Vijay Cancel reply

Your email address will not be published. Required fields are marked *