예제 #1
0
        public void GoogleSearch_test()
        {
            try
            {
                //initialize selenium browser
                SeleniumBrowser browser = new SeleniumBrowser(driver);

                //open google
                browser.GoToUrl("https://www.google.com/");

                //perform search
                driver.FindElementById("lst-ib").SendKeys("Testing with Selenium");
                driver.Keyboard.SendKeys(Keys.Enter);
                browser.WaitForLoad();

                //open selenium link
                driver.FindElementByXPath("//a[@href='https://www.seleniumhq.org/']").Click();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                SeleniumServer.Cleanup(driver);
            }
        }
예제 #2
0
        private SeleniumSupport CreateTarget(bool showWindow)
        {
            if (SeleniumServer == null)
            {
                SeleniumServer = SeleniumServer.Create(_location, _package, showWindow);
            }

            return(SeleniumSupport.Create(SeleniumServer));
        }
        public void Should_start_selenium_server()
        {
            SeleniumServer target = SeleniumServer.Create(_location, _package, false);

            target.Start();

            Assert.IsTrue(target.Started);

            target.Dispose();
        }
예제 #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            NativeMethods.PreventSleep();
            LoadSettings();
            LoadLocalIPAddress();
            DisplayAppVersion();
            toggle_enabled_hubAddress();

            CtxMenuNotifyIcon = new ContextMenu();
            CtxMenuNotifyIcon.MenuItems.Add("Open", (s, ev) =>
            {
                this.Show();
                WindowState = FormWindowState.Normal;
            });
            //CtxMenuNotifyIcon.MenuItems.Add("Exit", (s, ev) => Application.Exit());

            seleniumServer = new SeleniumServer(
                txtBox_ChromeDriver,
                txtBox_seleniumjar,
                txtBox_hubaddress,
                comboBox1,
                checkBox1,
                numericUpDown1,
                numericUpDown2,
                numericUpDown3,
                numericUpDown4,
                numericUpDown5
                );

            if (checkBox2.Checked)
            {
                if (checkIPFamily(txtBox_hubaddress.Text, comboBox1.SelectedValue.ToString()))
                {
                    WindowState = FormWindowState.Minimized;
                    RunTheSelenium(button1);
                }
                else
                {
                    notifyIcon1.Visible     = true;
                    notifyIcon1.ContextMenu = CtxMenuNotifyIcon;
                    notifyIcon1.ShowBalloonTip(500, "Selenium Node Runner", "Not able to start the client. Please select same machine IP address range with Hub IP address - " + comboBox1.SelectedValue.ToString(), ToolTipIcon.Warning);
                }
            }

            GridHubCheckTestTimer(true);

            try
            {
                checkForUpdate();
            }
            catch (Exception) { }
        }
예제 #5
0
        /// <summary>
        /// Stops selenium server
        /// </summary>
        public static void StopSeleniumServer()
        {
            if (SeleniumServer != null)
            {
                try
                {
                    SeleniumServer.Kill();

                    SeleniumServer = null;
                }
                catch (Exception) { }
                finally { SeleniumServer = null; }
            }
        }
 public void Should_throw_exception_on_start_of_selenium_server_due_to_no_package_file()
 {
     Assert.Throws <FileNotFoundException>(() => SeleniumServer.Create(_location, "selenium-server.txt", false));
 }
 public void Should_throw_exception_on_start_of_selenium_server_due_to_invalid_package()
 {
     Assert.Throws <ArgumentException>(() => SeleniumServer.Create(_location, "abc.txt", false));
 }
 public void Should_throw_exception_on_start_of_selenium_due_to_invalid_server_location()
 {
     Assert.Throws <DirectoryNotFoundException>(() => SeleniumServer.Create("C:\\Doesnotexist", _package, false));
 }
 public void Should_throw_exception_due_to_missing_package_setting()
 {
     Assert.Throws <ArgumentNullException>(() => SeleniumServer.Create(_location, "", false));
 }
예제 #10
0
 /// <summary>
 /// Waits the specified timeout.
 /// </summary>
 /// <param name="timeout">The timeout.</param>
 public void Wait(TimeSpan timeout)
 {
     SeleniumServer.Wait(timeout);
 }