示例#1
0
 /// <summary>Double-clicks an element.</summary>
 /// <param name="webelement">The element to double-click. If None, clicks on current mouse position.</param>
 /// <returns></returns>
 public Actions doubleClick(WebElement webelement = null)
 {
     if (webelement == null)
     {
         _actions.DoubleClick();
     }
     else
     {
         _actions.DoubleClick(webelement._webElement);
     }
     return(this);
 }
示例#2
0
        /// <summary>
        /// Find a system for a given user and hospital and double click on it
        /// </summary>
        /// <param name="systemText">The system to click on</param>
        /// <param name="username">The user that is performing the action</param>
        /// <param name="hospital">The hospital associated with the system</param>
        private void FindSystemAndDoubleClickOnIt(string systemText, string username, string hospital)
        {
            WebBrowser.Current.Navigate().GoToUrl("crs.crisphealth.org/reports");
            IWebElement currentSystemElement =
                Utility.Utility.GetElement(
                    By.XPath(String.Format("//div[contains(text(), '{0}')]",
                                           systemText.Substring(0, systemText.IndexOf(" ", System.StringComparison.Ordinal)))));

            if (currentSystemElement == null)
            {
                throw new Exception(String.Format("Cannot find system element on page for {0}",
                                                  systemText));
            }
            try
            {
                currentSystemElement.Click();
            }
            catch (ElementNotVisibleException e)
            {
                throw new Exception(String.Format("Element is not visible by browser for {0} {1} {2}",
                                                  username, systemText, hospital));
            }
            Actions action = new Actions(WebBrowser.Current);

            action.DoubleClick(currentSystemElement);
            action.Perform();
        }
 public static void DoubleClickOnObject(IControl control)
 {
     ScrollIntoView(control.WebElement);
     OpenQA.Selenium.Interactions.Actions actions = new OpenQA.Selenium.Interactions.Actions(BrowserUtilities.WebDriver);
     actions.DoubleClick(control.WebElement);
     actions.Perform();
 }
        public void MakePin(string proxy)
        {
            if (this.Disabled.Contains(proxy))
            {
                return;
            }
            try
            {
                int rand = new Random().Next(0, 9);

                ((IJavaScriptExecutor)Driver).ExecuteScript("window.open();");
                Driver.SwitchTo().Window(Driver.WindowHandles.Last());

                Driver.Url = "http://diy.gear.host/";
                File.AppendAllText(Path, proxy + Environment.NewLine);
                Thread.Sleep(new TimeSpan(0, 0, new Random().Next(4, 19)));

                var links = Driver.FindElementsByCssSelector("a");
                foreach (var item in links)
                {
                    Console.WriteLine(item.GetAttribute("href"));
                    try
                    {
                        if (item.GetAttribute("href") != null && item.GetAttribute("href").Contains("double"))
                        {
                            OpenQA.Selenium.Interactions.Actions action = new OpenQA.Selenium.Interactions.Actions(Driver);
                            action.MoveToElement(item);
                            action.DoubleClick(item);
                        }
                    }

                    catch { }
                }



                File.AppendAllText(Path, proxy + Environment.NewLine);
                Driver.FindElementByTagName("body").Click();
                Thread.Sleep(new TimeSpan(0, 0, new Random().Next(4, 19)));
                Driver.FindElementById("google").Click();
            }

            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                Driver.SwitchTo().Window(Driver.WindowHandles.First());
            }
        }
示例#5
0
        /// <summary>
        /// Verifies that user can see every system, hospital and casemix folder for his permissions
        /// Also verifies that if casemix = false in CSV file, user cannot see a casemix folder
        /// </summary>
        /// <param name="username">The user to check for</param>
        private void CheckEachPermittedSystemAndHospitalAndCasemixFolderForUser(string username)
        {
            string systemText = "";

            GetListOfUserPermittedCasemixFolders(username);

            // Check each permitted system and hospital folder for the user
            if (_userPermittedHospitalFolders != null)
            {
                foreach (string hospital in _userPermittedHospitalFolders)
                {
                    // Check system element (if the hospital for this system is statewide) and double click on it if this is the first time we've checked for it.
                    // Collapsing the system folder is needed to see the hospital folders
                    if (_hospitalAndStatewideMapping != null && (_hospitalAndStatewideMapping[hospital] == "1"))
                    {
                        // Update systemText for the current hospital
                        if (AllDistinctHospitalAndSystemFolders != null)
                        {
                            systemText = AllDistinctHospitalAndSystemFolders[hospital];
                            FindSystemAndDoubleClickOnIt(systemText, username, hospital);
                        }
                    }

                    // Verify that hospital is present if it is a statewide hospital
                    if (_hospitalAndStatewideMapping != null && _hospitalAndStatewideMapping[hospital] == "1")
                    {
                        Assert.IsTrue(
                            Utility.Utility.IsElementPresent(
                                By.XPath(String.Format("//div[contains(., '{0}')]", hospital))));
                        Console.WriteLine("{0} can see {1} with hospital {2}", username, systemText,
                                          hospital);
                    }

                    // Verify that casemix folder is present if user has casemix permission
                    if (_userPermittedHospitalAndCasemixMapping != null)
                    {
                        if (_userPermittedHospitalAndCasemixMapping[hospital])
                        {
                            IWebElement hospitalElement =
                                Utility.Utility.GetElement(By.XPath(String.Format("//div[contains(., '{0}')]", hospital)));
                            Actions action = new Actions(WebBrowser.Current);
                            action.DoubleClick(hospitalElement);
                            action.Perform();
                            Assert.IsTrue(
                                Utility.Utility.IsElementPresent(
                                    By.XPath(String.Format("//div[contains(., '{0}')]", "Patient Level Detail"))));
                            Console.WriteLine(String.Format("{0} can see patient level detail for system {1} and hospital {2}", username, systemText, hospital));
                        }
                        else
                        {
                            IWebElement hospitalElement =
                                Utility.Utility.GetElement(By.XPath(String.Format("//div[contains(., '{0}')]", hospital)));
                            Actions action = new Actions(WebBrowser.Current);
                            action.DoubleClick(hospitalElement);
                            action.Perform();
                            Assert.IsFalse(
                                Utility.Utility.IsElementPresent(
                                    By.XPath(String.Format("//div[contains(., '{0}')]", "Patient Level Detail"))));
                            Console.WriteLine(String.Format("{0} cannot see patient level detail for system {1} and hospital {2}", username, systemText, hospital));
                        }
                    }
                }
            }
        }
示例#6
0
        /// <summary>
        /// Метод реализует действие двойной клик по WebItem
        /// </summary>
        /// <param name="checkErrors">Проверить наличие ошибок. По умолчанию true - проверить</param>
        public void DoubleClick(bool checkErrors = true)
        {
            //реализуем дабл клик js скриптом
            OpenQA.Selenium.Interactions.Actions builder = new OpenQA.Selenium.Interactions.Actions(BitrixFramework.WebDriver);
            builder.DoubleClick(BitrixFramework.FindWebElement(this)).Build().Perform();

            Log.MesNormal(String.Format("'{0}' -> Дабл клик", description));
            if (checkErrors)
            {
                //проверяем страницу на наличие ошибок
                BitrixFramework.CheckJSErrors();
                GM.CheckContentOnErrors();
            }
        }
示例#7
0
        public static void DoubleClick(IWebElement element)
        {
            var actions = new OpenQA.Selenium.Interactions.Actions(WebDriver.Driver);

            actions.DoubleClick(element).Perform();
        }