public static void ecs_login_test()
        {
            BrowserWindow browser = BrowserWindow.Launch("https://www.ecs.csus.edu/index.php?content=ecs_portal");

            browser.Maximized = true;

            HtmlDocument doc = new HtmlDocument(browser);

            doc.FilterProperties[HtmlDocument.PropertyNames.Title] = "ECS Portal | Sacramento State | College of Engineering & Computer Science | Sacra" +
                                                                     "mento State";

            HtmlEdit loginTxt = new HtmlEdit(doc);

            loginTxt.SearchProperties[HtmlEdit.PropertyNames.Name] = "username";
            Keyboard.SendKeys(loginTxt, "Type your ECS username here");

            HtmlEdit passwordTxt = new HtmlEdit(doc);

            passwordTxt.SearchProperties[HtmlEdit.PropertyNames.Name] = "passwd";
            Keyboard.SendKeys(passwordTxt, "Type your ECS password here");

            HtmlInputButton loginButton = new HtmlInputButton(doc);

            loginButton.SearchProperties[HtmlButton.PropertyNames.Name] = "/portal_login";
            Mouse.Click(loginButton);

            Playback.Wait(10000);
            browser.Close();
        }
예제 #2
0
        public async Task OnPostOpenDialog()
        {
            try {
                BrowserWindow        window     = Electron.WindowManager.BrowserWindows.First();
                OpenDialogProperty[] properties = new OpenDialogProperty[] { OpenDialogProperty.openDirectory };
                string[]             directory  = await Electron.Dialog.ShowOpenDialogAsync(window, new OpenDialogOptions()
                {
                    Properties = properties
                });

                if (directory.Length <= 0)
                {
                    MessageBoxOptions options = new MessageBoxOptions("Error: Please choose a folder to open")
                    {
                        Buttons = new string[] { "OK" },
                        Type    = MessageBoxType.error,
                        Title   = "No folder chosen"
                    };
                    await Electron.Dialog.ShowMessageBoxAsync(options);

                    window.Close();
                }
                else
                {
                    EditorModel.Controller = new Controller(directory[0]);
                    window.LoadURL("http://localhost:8001/editor");
                }
            } catch (InvalidOperationException e) {
                Console.WriteLine($"Failed to open the directory open dialog: {e}");
            }
        }
예제 #3
0
        public bool ShowLogin(object o)
        {
            var url = new Uri(o.ToString());

            if (o == null) throw new ArgumentException(Dynamo.Wpf.Properties.Resources.InvalidLoginUrl);

            var navigateSuccess = false;

            // show the login
            context.Send((_) => {

                var window = new BrowserWindow(url)
                {
                    Title = Dynamo.Wpf.Properties.Resources.AutodeskSignIn,
                    Owner = parent,
                    WindowStartupLocation = WindowStartupLocation.CenterOwner
                };

                window.Browser.Navigated += (sender, args) =>
                {
                    // if the user reaches this path, they've successfully logged in
                    // note that this is necessary, but not sufficient for full authentication
                    if (args.Uri.LocalPath == "/OAuth/Allow")
                    {
                        navigateSuccess = true;
                        window.Close();
                    }
                };

                window.ShowDialog();

            }, null);

            return navigateSuccess;
        }
예제 #4
0
        internal void ShowShapewaysLogin(ShapewaysClient client) 
        {
            context.Send((_) =>
            {

                var window = new BrowserWindow(new Uri(client.LoginUrl))
                {
                    Title = "Shapeways",
                    Owner = parent,
                    WindowStartupLocation = WindowStartupLocation.CenterOwner,
                    Height = 500,
                    Width = 1000
                };

                window.Browser.LoadCompleted += (sender, args) => 
                {
                    if (args.Uri.AbsolutePath == "/callbackDynamoShapeways") 
                    {
                        client.SetToken(args.Uri.PathAndQuery);
                        window.Close();
                    }
                };

                window.Browser.Loaded += (sender, args) =>
                {
                    HideScriptErrors(window.Browser, true);
                };

                window.ShowDialog();

            }, null);
        }
예제 #5
0
        public void TestMethod1()
        {
            BrowserApplication webBrowser    = _desktop.BrowserApplication("google_com");
            BrowserWindow      browserWindow = webBrowser.BrowserWindow("BrowserWindow");

            Application xlApp       = new Application();
            Workbook    xlWorkBook  = xlApp.Workbooks.Open(@"d:\Projects\SilkTestLab5\Silk4NETProject\DDT.xls", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);;
            Worksheet   xlWorkSheet = (Worksheet)xlWorkBook.Worksheets.get_Item(1);;

            Microsoft.Office.Interop.Excel.Range range = xlWorkSheet.UsedRange;
            int rw = 4;

            for (int rCnt = 3; rCnt <= rw; rCnt++)
            {
                string operation1 = (range.Cells[rCnt, 1] as Microsoft.Office.Interop.Excel.Range).Value2.ToString();
                string operation2 = (range.Cells[rCnt, 2] as Microsoft.Office.Interop.Excel.Range).Value2.ToString();
                string operation3 = (range.Cells[rCnt, 3] as Microsoft.Office.Interop.Excel.Range).Value2.ToString();
                string res        = (range.Cells[rCnt, 4] as Microsoft.Office.Interop.Excel.Range).Value2.ToString();

                browserWindow.DomElement(operation1).Click();
                browserWindow.DomElement(operation2).Click();
                browserWindow.DomElement(operation3).Click();
                browserWindow.DomElement("DIV").Click();
                Assert.AreEqual(res, browserWindow.DomElement("cwos").GetProperty("textContents"));
                Assert.AreEqual(res, browserWindow.DomElement("cwos").Text);
            }

            xlWorkBook.Close(true, null, null);
            xlApp.Quit();

            browserWindow.Close();
        }
예제 #6
0
        internal void ShowShapewaysLogin(Shapeways client)
        {
            context.Send((_) =>
            {
                var window = new BrowserWindow(new Uri(client.LoginUrl))
                {
                    Title = "Shapeways",
                    Owner = parent,
                    WindowStartupLocation = WindowStartupLocation.CenterOwner,
                    Height = 500,
                    Width  = 1000
                };

                window.Browser.LoadCompleted += (sender, args) =>
                {
                    if (args.Uri.AbsolutePath == "/callbackDynamoShapeways")
                    {
                        client.SetToken(args.Uri.PathAndQuery);
                        window.Close();
                    }
                };

                window.Browser.Loaded += (sender, args) =>
                {
                    HideScriptErrors(window.Browser, true);
                };

                window.ShowDialog();
            }, null);
        }
예제 #7
0
        private async void Browser_GoogleConnected(object sender, EventArgs e)
        {
            BrowserWindow.Close();
            var args = e as ConnectedEventArgs;

            AuthService.GoogleAccessToken = args.ConnectionToken;
            await SendToGoogle(ImageFormat.Png);
        }
예제 #8
0
 private void PerformTest(Action <HtmlControl> testAction)
 {
     using (BrowserWindow bw = BrowserWindow.Launch(new Uri("http://localhost:3000/")))
     {
         bw.WaitForControlReady();
         testAction(new HtmlControl(bw.CurrentDocumentWindow));
         bw.Close();
     };
 }
예제 #9
0
        public static void CleanUp()
        {
            if (!Playback.IsInitialized)
            {
                Playback.Initialize();
            }
            BrowserWindow _bw = BrowserWindow.FromProcess(proc);

            _bw.Close();
        }
예제 #10
0
        public void SlList_DynamicObjectRecognition_Succeeds()
        {
            BrowserWindow b = BrowserWindow.Launch(PageUrl);

            b.SetFocus();
            SilverlightList oList = b.Find <SilverlightList>(By.AutomationId("listBox1"));

            oList.SelectedIndices = new[] { 2 };
            Assert.IsTrue(oList.SelectedItemsAsString == "Coded UI Test");
            b.Close();
        }
예제 #11
0
        public void SlTab_SelectedIndex_Succeeds()
        {
            BrowserWindow b = BrowserWindow.Launch(PageUrl);

            b.SetFocus();
            SilverlightTab oTab = b.Find <SilverlightTab>(By.AutomationId("tabControl1"));

            oTab.SelectedIndex = 1;
            Assert.IsTrue(oTab.SourceControl.Items[0].Name == "tabItem1");
            b.Close();
        }
예제 #12
0
        /// <summary>
        /// ClickCreate - Test Case 244
        /// </summary>
        public void ClickCreate()
        {
            #region Variable Declarations
            HtmlInputButton uICreateButton = this.UICreateWindowsInterneWindow.UICreateDocument.UIContentCustom.UICreateButton;
            BrowserWindow   uICustomersWindowsInteWindow = this.UICustomersWindowsInteWindow;
            #endregion

            // Click 'Create' button
            Mouse.Click(uICreateButton, new Point(126, 14));

            // Perform Close on Browser Window
            uICustomersWindowsInteWindow.Close();
        }
예제 #13
0
        public void SlButtonAndEditAndDTP_ClickAndSetTextAndSelectedDateAsString_Succeeds()
        {
            BrowserWindow b = BrowserWindow.Launch(PageUrl);

            b.SetFocus();
            b.Find <SilverlightButton>(By.AutomationId("button1")).Click();
            SilverlightEdit oEdit = b.Find <SilverlightEdit>(By.AutomationId("textBox1"));

            oEdit.Text = "asddasdasdasdadasdadasdadadadasd";
            SilverlightDatePicker dp = b.Find <SilverlightDatePicker>(By.AutomationId("datePicker1"));

            dp.SourceControl.SelectedDate = new DateTime(2011, 5, 11);
            b.Close();
        }
예제 #14
0
        private static string GetAuthCode(string account, Uri authenticationUri, Uri redirectUri)
        {
            string authCode = null;

            var browser = new BrowserWindow();

            browser.Authenticated += (s, e) => {
                authCode = e.Parameters.Get("code");
                browser.Close();
            };
            browser.Show(account, authenticationUri, redirectUri);

            return(authCode);
        }
예제 #15
0
        public void Launch_GetWindowTitle_Succeeds()
        {
            // Arrange
            string url         = currentDirectory + "/TestHtmlPage.html";
            string windowTitle = "A Test";

            // Act
            BrowserWindow window = BrowserWindow.Launch(url);

            // Assert
            Assert.IsTrue(window.Title.Contains(windowTitle));

            window.Close();
        }
예제 #16
0
        public void TestMethod1()
        {
            BrowserApplication webBrowser = _desktop.BrowserApplication("google_com");

            BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow");

            browserWindow.DomElement("1").Click();
            browserWindow.DomElement("×").Click();
            browserWindow.DomElement("2").Click();
            browserWindow.DomElement("DIV").Click();
            Assert.AreEqual("2", browserWindow.DomElement("cwos").GetProperty("textContents"));
            Assert.AreEqual("2", browserWindow.DomElement("cwos").Text);
            browserWindow.Close();
        }
        public void FromProcess_GetWindowTitle_Succeeds()
        {
            //Arrange
            WebPage.Launch(CurrentDirectory + "/TitleTest.html");

            //Act
            BrowserWindow bWin =
                WebPage.FromProcess(
                    Process.GetProcessesByName("iexplore").Single(x => !string.IsNullOrEmpty(x.MainWindowTitle)));

            //Assert
            Assert.AreEqual("A Test - Windows Internet Explorer", bWin.Title);

            bWin.Close();
        }
예제 #18
0
        private static Tuple <string, string> GetAuthCode(string account, Uri authenticationUri, Uri redirectUri)
        {
            string oauth_token = null, oauth_verifier = null;

            var browser = new BrowserWindow();

            browser.Authenticated += (s, e) => {
                oauth_token    = e.Parameters["oauth_token"];
                oauth_verifier = e.Parameters["oauth_verifier"];
                browser.Close();
            };
            browser.Show(account, authenticationUri, redirectUri);

            return(new Tuple <string, string>(oauth_token, oauth_verifier));
        }
예제 #19
0
        public void TestMethod1()
        {
            BrowserApplication webBrowser = _desktop.BrowserApplication("google_com");

            BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow");

            browserWindow.DomElement("4").Click();
            browserWindow.DomElement("+").Click();
            browserWindow.DomElement("8").Click();
            browserWindow.DomElement("DIV").Click();
            browserWindow.DomElement("cwos").Click();
            browserWindow.DomElement("AC").Click();
            Assert.AreEqual("0", browserWindow.DomElement("cwos").Text);
            browserWindow.Close();
        }
예제 #20
0
        public bool ShowLogin(object o)
        {
            if (o == null)
            {
                throw new ArgumentException(Resources.InvalidLoginUrl);
            }

            // URL shouldn't be empty.
            // URL can be empty, if user's local date is incorrect.
            // This a known bug, described here: https://github.com/DynamoDS/Dynamo/pull/6112
            if (o.ToString().Length == 0)
            {
                MessageBox.Show(Resources.InvalidTimeZoneMessage,
                                Resources.InvalidLoginUrl,
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return(false);
            }

            var url = new Uri(o.ToString());

            var navigateSuccess = false;

            // show the login
            context.Send(_ => {
                var window = new BrowserWindow(url)
                {
                    Title = Resources.AutodeskSignIn,
                    Owner = parent,
                    WindowStartupLocation = WindowStartupLocation.CenterOwner
                };

                window.Browser.Navigated += (sender, args) =>
                {
                    // if the user reaches this path, they've successfully logged in
                    // note that this is necessary, but not sufficient for full authentication
                    if (args.Uri.LocalPath == "/OAuth/Allow")
                    {
                        navigateSuccess = true;
                        window.Close();
                    }
                };

                window.ShowDialog();
            }, null);

            return(navigateSuccess);
        }
예제 #21
0
        public void TestMethod1()
        {
            BrowserApplication webBrowser = _desktop.BrowserApplication("google_com");

            BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow");

            browserWindow.DomElement("4").Click();
            browserWindow.DomElement("÷").Click();
            browserWindow.DomElement("0").Click();
            browserWindow.DomElement("DIV").Click();
            Assert.AreEqual("Infinity", browserWindow.DomElement("cwos").GetProperty("textContents"));
            Assert.AreEqual("Infinity", browserWindow.DomElement("cwos").Text);
            browserWindow.DomElement("http   www w3 org 20").Click();
            Assert.AreEqual("4 ÷ 0", browserWindow.DomElement("4 ÷ 0").Text);
            browserWindow.Close();
        }
예제 #22
0
 private void WebBrowser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
 {
     try
     {
         var callback = webBrowser.Source;
         var oauth    = FbClient.ParseOAuthCallbackUrl(callback);
         FbClient.AccessToken = oauth.AccessToken;
         FbAccountLoggedIn    = true;
         browserWindow.Close();
         MessageBox.Show("Authentication successful. You can now post recipes to Facebook.");
     }
     catch (Exception ex)
     {
         return;
     }
 }
예제 #23
0
        public void Click_ButtonInChildWindow_Succeeds()
        {
            BrowserWindow browserWindow = BrowserWindow.Launch(PageUrl);

            browserWindow.SetFocus();
            SilverlightButton button = browserWindow.Find <SilverlightButton>(By.AutomationId("displayChildWindowButton"));

            button.Click();

            SilverlightChildWindow childWindow = browserWindow.Find <SilverlightChildWindow>(By.AutomationId("TestChildWindow"));
            SilverlightButton      okButton    = childWindow.Find <SilverlightButton>(By.AutomationId("OKButton"));

            okButton.Click();

            browserWindow.Close();
        }
예제 #24
0
        public bool ShowLogin(object o)
        {
            if (o == null) throw new ArgumentException(Resources.InvalidLoginUrl);

            // URL shouldn't be empty.
            // URL can be empty, if user's local date is incorrect.
            // This a known bug, described here: https://github.com/DynamoDS/Dynamo/pull/6112
            if ((o as string).Length == 0)
            {
                MessageBox.Show(Resources.InvalidTimeZoneMessage,
                                Resources.InvalidLoginUrl,
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return false;
            }

            var url = new Uri(o.ToString());

            var navigateSuccess = false;

            // show the login
            context.Send(_ => {

                var window = new BrowserWindow(url)
                {
                    Title = Resources.AutodeskSignIn,
                    Owner = parent,
                    WindowStartupLocation = WindowStartupLocation.CenterOwner
                };

                window.Browser.Navigated += (sender, args) =>
                {
                    // if the user reaches this path, they've successfully logged in
                    // note that this is necessary, but not sufficient for full authentication
                    if (args.Uri.LocalPath == "/OAuth/Allow")
                    {
                        navigateSuccess = true;
                        window.Close();
                    }
                };

                window.ShowDialog();

            }, null);

            return navigateSuccess;
        }
예제 #25
0
        /*public AuthHelper()
         * {
         *
         * }
         *
         * public AuthHelper(string username)
         * {
         *  this.Username = username;
         * }
         *
         * public string Username
         * {
         *  get;
         *  set;
         * }
         */
        public static BrowserWindow KMTLogin()
        {
            //Clear IE browser cache
            BrowserWindow.ClearCache();

            //Launch IE browser and navigate to the KMT site.
            var           uri           = new System.Uri("http://*****:*****@statedept.us";

            HtmlEdit password = new HtmlEdit(browserWindow);

            password.SearchProperties.Add(HtmlEdit.PropertyNames.TagName, "INPUT", HtmlEdit.PropertyNames.Id, "cred_password_inputtext");
            password.Text = "ECATeam!2015_4";

            //Click Sign In button

            HtmlControl signinButton = new HtmlControl(browserWindow);

            signinButton.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "SPAN", HtmlControl.PropertyNames.Id, "cred_sign_in_button", HtmlControl.PropertyNames.InnerText, "Sign in");
            Mouse.Click(signinButton);

            return(browserWindow);
        }
예제 #26
0
        public void SetTextOnHtmlEdit(string browser)
        {
            //Arrange
            IBrowser previousBrowser = BrowserWindowUnderTest.GetCurrentBrowser();

            try
            {
                string tempFilePath = Path.GetTempFileName();

                File.WriteAllText(tempFilePath,
                                  @"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <div id=""div1"">
            <input type=""text""/>
        </div>
    </body>
</html>");

                BrowserWindow.CurrentBrowser = browser;

                BrowserWindow window       = BrowserWindow.Launch(tempFilePath);
                var           div          = window.Find <HtmlDiv>(By.Id("div1"));
                var           inputTextBox = div.Find <HtmlEdit>();

                //Act
                inputTextBox.Text = "text";

                //Assert
                Assert.AreEqual("text", inputTextBox.Text);

                window.Close();

                File.Delete(tempFilePath);
            }
            finally
            {
                BrowserWindow.CurrentBrowser = previousBrowser.Name;
            }
        }
예제 #27
0
        /// <summary>
        /// RecordedMethod2
        /// </summary>
        public void RecordedMethod2()
        {
            #region Variable Declarations
            HtmlHyperlink uIAboutHyperlink             = this.UIHomePageMyASPNETApplWindow.UIHomePageMyASPNETApplDocument.UIAboutHyperlink;
            HtmlHyperlink uIContactHyperlink           = this.UIHomePageMyASPNETApplWindow.UIAboutMyASPNETApplicaDocument.UIContactHyperlink;
            BrowserWindow uIHomePageMyASPNETApplWindow = this.UIHomePageMyASPNETApplWindow;
            #endregion

            // Click 'About' link
            Mouse.Click(uIAboutHyperlink, new Point(47, 28));

            // Click 'Contact' link
            Mouse.Click(uIContactHyperlink, new Point(56, 28));

            // Perform Forward on Browser Window
            uIHomePageMyASPNETApplWindow.Forward();

            // Perform Close on Browser Window
            uIHomePageMyASPNETApplWindow.Close();
        }
예제 #28
0
        public void TestHelloWorld()
        {
            // Open a browser
            BrowserWindow testBrowser = BrowserWindow.Launch();

            // Initialize the eyes SDK and set your private API key.
            var eyes = new Eyes();

            try
            {
                // Start the test and set the browser's viewport size to 800x600
                eyes.Open(testBrowser, "Hello World!", "My first CodedUI C# test", new Size(800, 600));

                // Navigate the browser to the "hello world!" web-site.
                testBrowser.NavigateToUrl(new Uri("https://applitools.com/helloworld"));

                // Visual checkpoint #1
                eyes.CheckWindow("Hello!");

                // Click the "Click me!" button
                HtmlDocument doc    = new HtmlDocument(testBrowser);
                HtmlButton   button = new HtmlButton(doc);
                Mouse.Click(button);

                // Visual checkpoint #2
                eyes.CheckWindow("Click!");

                // End the test
                eyes.Close();
            }
            finally
            {
                // Close the browser.
                testBrowser.Close();

                // If the test was aborted before eyes.Close was called, ends the test as aborted.
                eyes.AbortIfNotClosed();
            }
        }
예제 #29
0
        public void SlTab_TraverseSiblingsAndChildren_Succeeds()
        {
            BrowserWindow b = BrowserWindow.Launch(PageUrl);

            b.SetFocus();
            SilverlightTab oTab = b.Find <SilverlightTab>(By.AutomationId("tabControl1"));

            oTab.SelectedIndex = 0;
            var btnOK = b.Find <SilverlightButton>(By.AutomationId("OKButtonInTabItem1"));

            ((SilverlightEdit)(btnOK.PreviousSibling)).Text = "blah blah hurray";
            foreach (ControlBase control in oTab.GetChildren())
            {
                if (control.GetType() == typeof(SilverlightEdit))
                {
                    ((SilverlightEdit)control).Text = "Text Changed";
                    break;
                }
            }
            Assert.IsTrue(((SilverlightTab)btnOK.Parent).SelectedItem == "tabItem1");
            b.Close();
        }
예제 #30
0
        public void FromProcess_GetWindowTitle_Succeeds()
        {
            // Arrange
            using (TempFile tempFile = new TempFile(
                       @"<html>
    <head>
        <title>A Test</title>
    </head>
    <body/>
</html>"))
            {
                BrowserWindowUnderTest.Launch(tempFile.FilePath);

                // Act
                BrowserWindow browserWindow = BrowserWindow.FromProcess(Process.GetProcessesByName("iexplore").Single(x => !string.IsNullOrEmpty(x.MainWindowTitle)));

                // Assert
                Assert.IsTrue(browserWindow.Title.Contains("A Test"), browserWindow.Title);

                browserWindow.Close();
            }
        }
예제 #31
0
        public bool ShowLogin(object o)
        {
            var url = o as Uri;

            if (o == null)
            {
                throw new ArgumentException(Dynamo.Wpf.Properties.Resources.InvalidLoginUrl);
            }

            var navigateSuccess = false;

            // show the login
            context.Send((_) => {
                var window = new BrowserWindow(url)
                {
                    Title = Dynamo.Wpf.Properties.Resources.AutodeskSignIn,
                    Owner = parent,
                    WindowStartupLocation = WindowStartupLocation.CenterOwner
                };

                window.Browser.Navigated += (sender, args) =>
                {
                    // if the user reaches this path, they've successfully logged in
                    // note that this is necessary, but not sufficient for full authentication
                    if (args.Uri.LocalPath == "/OAuth/Allow")
                    {
                        navigateSuccess = true;
                        window.Close();
                    }
                };

                window.ShowDialog();
            }, null);

            return(navigateSuccess);
        }
예제 #32
0
 public void Cleanup()
 {
     browser.Close();
 }
예제 #33
0
 public override void Close()
 {
     ieWindow.Close();
 }