當前位置: 首頁>>代碼示例>>C#>>正文


C# Actions.MoveToElement方法代碼示例

本文整理匯總了C#中OpenQA.Selenium.Interactions.Actions.MoveToElement方法的典型用法代碼示例。如果您正苦於以下問題:C# Actions.MoveToElement方法的具體用法?C# Actions.MoveToElement怎麽用?C# Actions.MoveToElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenQA.Selenium.Interactions.Actions的用法示例。


在下文中一共展示了Actions.MoveToElement方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ActivateWorkload

 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public DashboardPage ActivateWorkload()
 {
     bool isActivateButtonDisplayed = this.WaitForElement("XPATH", (string)objectRepository.ObjectRepositoryTable["ActivateButton"]);
     if (isActivateButtonDisplayed)
     {
         activateButtonControl = this.FindControlByXPath((string)objectRepository.ObjectRepositoryTable["ActivateButton"]);
         Actions action = new Actions(this.Browser.Driver);
         action.MoveToElement(activateButtonControl).DoubleClick().Perform();
         ImplicitlyWait(5000);
         bool isActivateTrialButtonDisplayed = this.WaitForElement("XPATH", (string)objectRepository.ObjectRepositoryTable["ActivateTrialButton"]);
         if (isActivateTrialButtonDisplayed)
         {
             IWebElement activateTrailButtonControl = this.FindControlByXPath((string)objectRepository.ObjectRepositoryTable["ActivateTrialButton"]);
             action.MoveToElement(activateTrailButtonControl).DoubleClick().Perform();
             ImplicitlyWait(10000);
             return new DashboardPage(this.Browser);
         }
         else
         {
             throw new Exception("Activate Trial Button not found");
         }
     }
     else
     {
         throw new Exception("Activate button not found");
     }
 }
開發者ID:paragvpatil,項目名稱:InPodsAutomation,代碼行數:31,代碼來源:WorkspacePage.cs

示例2: LogOut

 public HomePage LogOut()
 {
     var actions = new Actions(Starter.WebDriver);
     actions.MoveToElement(_loggedAvatar).Perform();
     Starter.WaitForElementVisible(By.CssSelector("a[data-id='logout']"));
     actions.MoveToElement(_logoutLink).Click().Perform();
     return PageObjects.HomePage;
 }
開發者ID:GrzegorzWitek,項目名稱:WikiTest,代碼行數:8,代碼來源:SharedActions.cs

示例3: ClickPageTitle

 public void ClickPageTitle()
 {
     WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(waitsec));
     IWebElement elem = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#form_title_div>div>h1")));
     Actions action = new Actions(driver);
     action.MoveToElement(elem).ClickAndHold().Build().Perform();
     Thread.Sleep(1000);
     action.MoveToElement(elem).Release().Build().Perform();
 }
開發者ID:pjagga,項目名稱:SeleniumMSTestVS2013,代碼行數:9,代碼來源:ConnectionPage.cs

示例4: ClickActivitiesAddButton

 public void ClickActivitiesAddButton()
 {
     WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(waitsec));
     wait.Until(ExpectedConditions.ElementIsVisible(By.Id("FormTitle"))).Click();
     IWebElement elem = wait.Until(ExpectedConditions.ElementIsVisible(By.Id("Subgrid_Activities_addImageButtonImage")));
     Actions action = new Actions(driver);
     action.MoveToElement(elem).ClickAndHold().Build().Perform();
     Thread.Sleep(1000);
     action.MoveToElement(elem).Release().Build().Perform();
 }
開發者ID:pjagga,項目名稱:SeleniumMSTestVS2013,代碼行數:10,代碼來源:InvestigationMasterCasePage.cs

示例5: FigureChose

        public static void FigureChose(int link)
        {
            var hover = Driver.Instance.FindElements(By.CssSelector("div.figure img"))[link];
            var elementToClick = Driver.Instance.FindElement(By.CssSelector("div.figcaption a"));
            //hover odglumiti

            Actions action = new Actions(Driver.Instance);
            action.MoveToElement(hover).Perform();
            action.MoveToElement(elementToClick).Click().Perform();
        }
開發者ID:sanella,項目名稱:Job-Training-Selenium,代碼行數:10,代碼來源:HoverPage.cs

示例6: ClickCreateButton

 public void ClickCreateButton()
 {
     this.driver.SwitchTo().DefaultContent();
     WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(waitsec));
     IWebElement elem = wait.Until(ExpectedConditions.ElementIsVisible(By.Id("navTabGlobalCreateImage")));
     Actions action = new Actions(driver);
     action.MoveToElement(elem).ClickAndHold().Build().Perform();
     Thread.Sleep(2000); //Temporary
     action.MoveToElement(elem).Release().Build().Perform();
     Thread.Sleep(1000);
 }
開發者ID:pjagga,項目名稱:SeleniumMSTestVS2013,代碼行數:11,代碼來源:InvestigationMasterCaseSearchPage.cs

示例7: ClickDeactivateButton

        public void ClickDeactivateButton()
        {
            this.driver.SwitchTo().DefaultContent();

            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(waitsec));
            IWebElement elem = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("img[alt='Deactivate']")));
            Actions action = new Actions(driver);
            action.MoveToElement(elem).ClickAndHold().Build().Perform();
            Thread.Sleep(1000);
            action.MoveToElement(elem).Release().Build().Perform();
        }
開發者ID:pjagga,項目名稱:SeleniumMSTestVS2013,代碼行數:11,代碼來源:TenancyRequestPartyPage.cs

示例8: ClickBondTenancyRequestRibbonButton

        public void ClickBondTenancyRequestRibbonButton()
        {
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(waitsec));
            IWebElement elem = wait.Until(ExpectedConditions.ElementIsVisible(By.Id("Node_nav_rta_tenancy_rta_tenancy_request")));
            Actions action = new Actions(driver);
            action.MoveToElement(elem).ClickAndHold().Build().Perform();
            Thread.Sleep(1000);
            action.MoveToElement(elem).Release().Build().Perform();

            RefreshPageFrame.RefreshPage(driver, frameId);
        }
開發者ID:pjagga,項目名稱:SeleniumMSTestVS2013,代碼行數:11,代碼來源:TenancyPage.cs

示例9: ClickAllContributionsElement

        public void ClickAllContributionsElement()
        {
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(waitsec));
            IWebElement elem = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//div/a/h2[contains(.,'All Contributors')]")));

            Actions action = new Actions(driver);
            action.MoveToElement(elem).ClickAndHold().Build().Perform();
            Thread.Sleep(1000);
            action.MoveToElement(elem).Release().Build().Perform();
            Thread.Sleep(2000);
        }
開發者ID:pjagga,項目名稱:SeleniumMSTestVS2013,代碼行數:11,代碼來源:TenancyPage.cs

示例10: ClickActivityListItem

 public void ClickActivityListItem(string activity)
 {
     WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(waitsec));
     IWebElement parent = wait.Until(ExpectedConditions.ElementIsVisible(By.Id("tblItems")));
     IWebElement elem = parent.FindElement(By.XPath("//*[contains(text(),'" + activity + "')]"));
     Actions action = new Actions(driver);
     action.MoveToElement(elem).Build().Perform();
     Thread.Sleep(1000);
     action.MoveToElement(elem).ClickAndHold().Build().Perform();
     Thread.Sleep(2000);
     action.MoveToElement(elem).Release().Build().Perform();
 }
開發者ID:pjagga,項目名稱:SeleniumMSTestVS2013,代碼行數:12,代碼來源:NewActivityPage.cs

示例11: ClearTextBoxValue

        public static void ClearTextBoxValue(string elementId, IWebDriver d)
        {
            WebDriverWait wait = new WebDriverWait(d, TimeSpan.FromSeconds(waitsec));
            IWebElement elem = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#" + elementId + ">div")));
            Actions actions = new Actions(d);
            actions.MoveToElement(elem,0,0).Click().Build().Perform();

            Thread.Sleep(500);
            IWebElement el = wait.Until(ExpectedConditions.ElementIsVisible(By.Id(elementId + "_i")));
            actions.MoveToElement(elem, 0, 0).Click().Build().Perform();
            el.Clear();
            el.SendKeys(Keys.Backspace);
        }
開發者ID:pjagga,項目名稱:SeleniumMSTestVS2013,代碼行數:13,代碼來源:UICommon.cs

示例12: ClickUnsavedChangesButton

        public void ClickUnsavedChangesButton()
        {
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(waitsec));
            IWebElement elem = wait.Until(ExpectedConditions.ElementIsVisible(By.Id("savefooter_statuscontrol")));

            Actions action = new Actions(driver);
            Thread.Sleep(2000);
            action.MoveToElement(elem).ClickAndHold().Build().Perform();
            Thread.Sleep(2000);
            action.MoveToElement(elem).Release().Build().Perform();
            Thread.Sleep(2000);
            WaitForPageToLoad.WaitToLoad(driver);
        }
開發者ID:pjagga,項目名稱:SeleniumMSTestVS2013,代碼行數:13,代碼來源:TenancyRequestQueueReasonPage.cs

示例13: ClickDeactivateIMG

 public void ClickDeactivateIMG()
 {
     RefreshPageFrame.RefreshPage(driver, frameId);
     driver.SwitchTo().DefaultContent();
     WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(waitsec));
     wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("img[alt='Deactivate']")));
     Thread.Sleep(2000);
     Actions action = new Actions(driver);
     action.MoveToElement(driver.FindElement(By.CssSelector("img[alt='Deactivate']"))).ClickAndHold().Build().Perform();
     Thread.Sleep(2000);
     action.MoveToElement(driver.FindElement(By.CssSelector("img[alt='Deactivate']"))).Release().Build().Perform();
     wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("img[alt='Activate']")));
     driver.SwitchTo().Frame(frameId);
 }
開發者ID:pjagga,項目名稱:SeleniumMSTestVS2013,代碼行數:14,代碼來源:AlerPage.cs

示例14: MaxZoom

        //an boundary constraint (to prevent the user from observing the future and the past(e.g. before 13.7Ga BC) )
        public void MaxZoom(double lt, double rt, int zoom)
        {
            IWebElement buttonZoomOut = Driver.FindElement(By.Id("buttonZoomOut"));
            Actions actions = new Actions(Driver);

            (Driver as IJavaScriptExecutor).ExecuteScript("$(\"#axis\").axis(\"setRange\"," + lt + "," + rt + ");");

            actions.Build();
            actions.MoveToElement(buttonZoomOut, 0, 0);
            for (int k = 0; k < zoom; k++)
            {
                actions.Click();
            }
            actions.Release();
            actions.Perform();

            var afterZoom = (Driver as IJavaScriptExecutor).
            ExecuteScript("return $(\"#axis\").axis(\"getRange\");");

            var afterzooml = Convert.ToDouble((afterZoom as Dictionary<string, object>)["left"]);
            var afterzoomr = Convert.ToDouble((afterZoom as Dictionary<string, object>)["right"]);

            Assert.IsTrue(afterzooml >= -13700000000.0);
            Assert.IsTrue(afterzoomr <= 0.0);
        }
開發者ID:Bzdun,項目名稱:NewProject,代碼行數:26,代碼來源:AxisZoomTestIntestAxisPage.cs

示例15: Main

        static void Main(string[] args)
        {
            IWebDriver driver = new FirefoxDriver();

            driver.Navigate().GoToUrl("http://www.integrationqa.com/");

            driver.Manage().Window.Maximize();

            driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
            IWebElement menu = driver.FindElement(By.Id("hs_menu_wrapper_module_13970568219884"));
            Actions builder = new Actions(driver);
            builder.MoveToElement(menu).Build().Perform();

            IList<IWebElement> menuItemsList = menu.FindElements(By.ClassName("hs-menu-item"));

            String[] menuItems = new String[menuItemsList.Count];
            int i = 0;
            foreach (IWebElement menuItem in menuItemsList)
            {
                menuItems[i++] = menuItem.Text;
            }

            //Arrange all the list items in alphabetical order
            IEnumerable<String> orderedMenuList = menuItems.OrderBy(lv_menu => lv_menu).ToList();

            //Display the ordered list
            foreach (var menuItem in orderedMenuList)
            {
                if (menuItem.Length > 0)
                    Console.WriteLine(menuItem);
            }
            Console.ReadKey();
        }
開發者ID:SahanaVishakanta,項目名稱:WebDriverProjects,代碼行數:33,代碼來源:Program.cs


注:本文中的OpenQA.Selenium.Interactions.Actions.MoveToElement方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。