Esempio n. 1
0
        /// <summary>
        /// Action to perform Right Click
        /// </summary>
        /// <param name="element">element to be right clicked</param>
        public static void RightClick(IWebElement element)
        {
            IWebDriver driver = ((OpenQA.Selenium.Internal.IWrapsDriver)element).WrappedDriver;
            var        action = new OpenQA.Selenium.Interactions.Actions(driver);

            action.ContextClick(element);
            action.Perform();
            action.ContextClick().Perform();
        }
        public void RightClick()
        {
            LOG.Information("Right clicking on element: {0}", WebElement);
            var action = new OpenQA.Selenium.Interactions.Actions(WebDriver);

            action.ContextClick(WebElement).Perform();
        }
Esempio n. 3
0
        public void ShouldAllowContextClick()
        {
            driver.Url = javascriptPage;

            IWebElement toContextClick = driver.FindElement(By.Id("doubleClickField"));

            Actions actionProvider = new Actions(driver);
            IAction contextClick = actionProvider.ContextClick(toContextClick).Build();

            contextClick.Perform();
            Assert.AreEqual("ContextClicked", toContextClick.GetAttribute("value"));
        }
Esempio n. 4
0
        public void ShouldAllowContextClick()
        {
            driver.Url = javascriptPage;

            IWebElement toContextClick = driver.FindElement(By.Id("doubleClickField"));

            Actions actionProvider = new Actions(driver);
            IAction contextClick   = actionProvider.ContextClick(toContextClick).Build();

            contextClick.Perform();
            Assert.AreEqual("ContextClicked", toContextClick.GetAttribute("value"));
        }
Esempio n. 5
0
 /// <summary>
 /// Right click method
 /// </summary>
 /// <param name="element">element which is do right click</param>
 internal static void RClick(IWebElement element)
 {
     try
     {
         OpenQA.Selenium.Interactions.Actions action = new OpenQA.Selenium.Interactions.Actions(webDriver);
         action.ContextClick(element).Perform();
     }
     catch (WebDriverException)
     {
         Wait(TimeSpan.FromSeconds(15));
     }
 }
Esempio n. 6
0
 public void ChangeName()
 {
     var task9 = new Task9(this.Driver);
     task9.NavigateToPage(GetHost() + "task_9");
     Driver.WaitForElement(By.CssSelector("#j1_1 i.jstree-ocl"), 2).Click();
     Driver.WaitForElement(By.CssSelector("#j1_2 i.jstree-ocl"), 2).Click();
     var j11anchor = Driver.WaitForElement(By.CssSelector("j1_1_anchor"), 2);
     Actions action = new Actions(Driver);
     action.ContextClick(j11anchor).Perform();
     Driver.WaitForElement(By.CssSelector(".vakata-context.jstree-contextmenu.jstree-default-contextmenu"), 2).Click();
     Driver.WaitForElement(By.CssSelector("j1_1_anchor"), 2).SendKeys("Abc");
 }
Esempio n. 7
0
        public void TestContextClick()
        {
            NavigationHelper.NavigateToUrl("http://demos.telerik.com/kendo-ui/dragdrop/events");
            Actions act = new Actions(ObjectRepository.Driver);
            IWebElement ele = ObjectRepository.Driver.FindElement(By.Id("draggable"));

            act.ContextClick(ele)
                .Build()
                .Perform();

            Thread.Sleep(5000);
        }
		public void SelectFromContextMenu(string pageName, string option)
		{
			Trace.WriteLine(BasePage.TraceLevelPage + "Select from Context menu:");
			Actions builder = new Actions(_driver);
			builder.ContextClick(
				WaitForElement(By.XPath("//div[contains(@id, 'Tabs_ctlPages')]//span[text() = '" + pageName + " ']"))).
				MoveToElement(WaitForElement(By.XPath(option))).Build().Perform();

			FindElement(By.XPath(option)).Info();

			Trace.WriteLine(BasePage.TraceLevelPage + "Click on option: " + option);
			Click(By.XPath(option));
		}
 public void RightClickExample()
 {
     Driver.Navigate().GoToUrl("http://the-internet.herokuapp.com/context_menu");
     IWebElement MenuArea = Driver.FindElement(By.Id("hot-spot"));
     Actions Builder = new Actions(Driver);
     Builder.ContextClick(MenuArea)
         .SendKeys(Keys.ArrowDown)
         .SendKeys(Keys.ArrowDown)
         .SendKeys(Keys.ArrowDown)
         .SendKeys(Keys.ArrowDown)
         .SendKeys(Keys.ArrowDown)
         .SendKeys(Keys.Enter)
         .Perform();
     IAlert Alert = Driver.SwitchTo().Alert();
     Assert.That(Alert.Text.Equals("You selected a context menu"));
 }
Esempio n. 10
0
        public string GetCellContainsValueRefreshed(string lookupColumn, string lookupValue, string returnColumn, 
            string refreshValue, int refreshTime, IWebDriver driver)
        {
            int lookupColumnIndex = this.GetColumnIndex(lookupColumn);
            int returnColumnIndex = this.GetColumnIndex(returnColumn);

            IReadOnlyCollection<IWebElement> rows = this.element.FindElements(By.CssSelector("tbody tr"));
            foreach (IWebElement row in rows)
            {
                if (row.Text != "")
                {
                    for (int i = 1; i <= refreshTime; i++)
                    {

                        IReadOnlyCollection<IWebElement> cells = row.FindElements(By.TagName("td"));
                        if (cells.ElementAt(lookupColumnIndex).Text.Contains(lookupValue))
                        {
                            if (cells.ElementAt(returnColumnIndex).Text.Contains(refreshValue))
                            {
                                return cells.ElementAt(returnColumnIndex).Text;
                            }

                            else
                            {
                                Thread.Sleep(3000);
                                Actions action = new Actions(driver);
                                action.ContextClick(row).Perform();
                                IWebElement elementOpen = driver.FindElement(By.LinkText("Refresh List"));
                                elementOpen.Click();
                                rows = this.element.FindElements(By.CssSelector("tbody tr"));
                            }
                        }
                    }
                }
            }

            throw new Exception(String.Format("Unable to find table row {0} with value {1}", lookupColumn, lookupValue));
        }
        public static void DeleteQuery(string xQuery,string xDeleteQuery)
        {
            WebDriverWait wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10));
            wait.IgnoreExceptionTypes(typeof(InvalidOperationException));
            Actions clicker = new Actions(Driver);
            try
            {
                wait.Until(d =>
                {
                    QueryLinkElement = d.FindElement(By.XPath(xQuery));

                    if (QueryLinkElement == null ||
                        QueryLinkElement.Displayed == false ||
                        QueryLinkElement.Enabled == false) return false;
                    return true;
                });
            }
            catch (Exception)
            {
                throw new NoSuchElementException();
            }

            wait.Until(d =>
            {
                clicker.ContextClick(QueryLinkElement).Perform();

                DeleteQueryLinkElement = d.FindElement(By.XPath(xDeleteQuery));

                if (DeleteQueryLinkElement == null ||
                    DeleteQueryLinkElement.Displayed == false ||
                    DeleteQueryLinkElement.Enabled == false) return false;
                DeleteQueryLinkElement.Click();
                return true;
            });

            wait.Until(d =>
            {
                YesReallyDeleteElement = d.FindElement(By.XPath(getXButton("Yes")));

                if (YesReallyDeleteElement == null ||
                    YesReallyDeleteElement.Displayed == false) return false;
                YesReallyDeleteElement.Click();
                return true;
            });
        }
Esempio n. 12
0
 public IMouseActions ContextClick()
 {
     actions.ContextClick();
     return(this);
 }
		public void SelectFromContextMenu(string pageName, string option)
		{
			Trace.WriteLine(BasePage.TraceLevelPage + "Select from Context menu:");

			WaitForElement(By.XPath(PageList + "//span[text() = '" + pageName + " ']")).Info();

			Actions builder = new Actions(_driver);
			builder.ContextClick(
				FindElement(By.XPath(PageList + "//span[text() = '" + pageName + " ']"))).
				MoveToElement(WaitForElement(By.XPath(option))).Build().Perform();

			Thread.Sleep(1000);

			Trace.WriteLine(BasePage.TraceLevelPage + "Click on option: " + option);
			Click(By.XPath(option));
		}
Esempio n. 14
0
		public void FileViewSelectFromContextMenu(string fileName, string option)
		{
			Trace.WriteLine(TraceLevelComposite + "Select from Context menu:");

			WaitForElement(By.XPath(FileView + "//tr/td/div[@title = '" + fileName + "']")).Info();

			Actions builder = new Actions(_driver);
			builder.ContextClick(
				FindElement(By.XPath(FileView + "//tr/td/div[@title = '" + fileName + "']"))).
				MoveToElement(WaitForElement(By.XPath(option)).WaitTillEnabled()).Build().Perform();

			Thread.Sleep(1000);

			Trace.WriteLine(TraceLevelPage + "Click on option: " + option);
			WaitAndClick(By.XPath(option));
		}