当前位置: 首页>>代码示例>>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;未经允许,请勿转载。