本文整理汇总了C#中OpenQA.Selenium.Interactions.Actions.ContextClick方法的典型用法代码示例。如果您正苦于以下问题:C# Actions.ContextClick方法的具体用法?C# Actions.ContextClick怎么用?C# Actions.ContextClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenQA.Selenium.Interactions.Actions
的用法示例。
在下文中一共展示了Actions.ContextClick方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeName
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");
}
示例2: ShouldAllowContextClick
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"));
}
示例3: TestContextClick
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);
}
示例4: SelectFromContextMenu
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));
}
示例5: RightClickExample
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"));
}
示例6: GetCellContainsValueRefreshed
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));
}
示例7: DeleteQuery
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;
});
}
示例8: SelectFromContextMenu
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));
}
示例9: FileViewSelectFromContextMenu
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));
}