本文整理汇总了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");
}
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}