本文整理汇总了C#中OpenQA.Selenium.Interactions.Actions.Perform方法的典型用法代码示例。如果您正苦于以下问题:C# Actions.Perform方法的具体用法?C# Actions.Perform怎么用?C# Actions.Perform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenQA.Selenium.Interactions.Actions
的用法示例。
在下文中一共展示了Actions.Perform方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MoveToFooter
protected void MoveToFooter(IWebElement footer)
{
Actions actions = new Actions(chrome);
actions.MoveToElement(footer);
actions.Perform();
Thread.Sleep(1000);
}
示例2: 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);
}
示例3: CreateInd
public static void CreateInd(TitlesList.EnumAdminLeftBar pageName)
{
// ReadOnlyCollection<IWebElement> topBarElements;
Driver.Wait(2);
/*Array enumNamesTopBar = Enum.GetNames(typeof(TitlesList.EnumTitlesTopBar));
int pos = Array.IndexOf(enumNamesTopBar, pageName);
if (pos > -1)
{
topBarElements = Driver.Instance.FindElements(By.ClassName("topbar"));
}
else
{
topBarElements = Driver.Instance.FindElements(By.ClassName("admin-left-navigation-panel"));
}*/
/* var barElements = Driver.Instance.FindElements(By.ClassName("admin-inner-page-content"));
int valueOfEnum = (int)pageName;
// string pageNameString = Enum.GetName(typeof(TitlesList.EnumAdminLeftBar), valueOfEnum).ToString();
string pageNameString = pageName.ToString();
pageNameString = pageNameString.Replace('_', ' ');
foreach (var row in barElements)
{
ReadOnlyCollection<IWebElement> links = null;
// Driver.NoWait(() => links = row.FindElements(By.LinkText(pageName)));
links = row.FindElements(By.PartialLinkText("Add new"));
if (links.Count > 0)
{
links[0].Click();
}
}*/
var link1 = Driver.Instance.FindElement(By.LinkText("Add new"));
link1.Click();
Driver.Wait(2);
var inputs = Driver.Instance.FindElements(By.TagName("input"));
inputs[0].SendKeys("Test Title");
inputs[1].SendKeys("Test Id");
var inputs1 = Driver.Instance.FindElement(By.CssSelector("body>div:nth-child(1)>section >div.admin-pages-content>div.admin-inner-page-content>div>form>fieldset>div:nth-child(2)>div:nth-child(8)>span.k-widget.k-dropdown.k-header.ng-pristine.ng-valid.ng-touched>span>span.k-input.ng-scope"));
Actions action = new Actions(Driver.Instance);
action.MoveToElement(inputs1);
action.Perform();
action.Click();
action.Perform();
}
示例4: ZoomBackToNormal
public static void ZoomBackToNormal()
{
Actions zoomBackToNormal = new Actions(Browser.Driver);
zoomBackToNormal.KeyDown(Keys.Control)
.SendKeys("0")
.KeyUp(Keys.Control);
zoomBackToNormal.Perform();
}
示例5: ClickCategoryTree
private static void ClickCategoryTree(string category)
{
var expandNode = driver.FindElement(By.XPath("//div[@id='navigation']//span[text()='" + category + "']/parent::*/parent::*"), 5);
Console.WriteLine(expandNode.GetAttribute("class"));
var actions = new Actions(driver);
actions.MoveToElement(expandNode);
actions.Click();
actions.Perform();
}
示例6: ZoomOut
public static void ZoomOut()
{
Actions zoomOut = new Actions(Browser.Driver);
zoomOut.KeyDown(Keys.Control)
.SendKeys(Keys.Subtract)
.SendKeys(Keys.Subtract)
.KeyUp(Keys.Control);
zoomOut.Perform();
}
示例7: OpenAddVideoPage
public AddVideoPage OpenAddVideoPage()
{
var action = new Actions(Starter.WebDriver);
action.MoveToElement(ContributeButton)
.Click()
.MoveToElement(AddVideoLink)
.Click();
action.Perform();
return PageObjects.AddVideoPage;
}
示例8: EditCollateral
public void EditCollateral(String amount)
{
Browser.Browser.ClickByXPath("//div[text()='Collateral']");
IWebElement natAmount = Browser.Browser.Instance.FindElement(By.Id("8_Collateral_CollateralValue_ExternalDiv"));
Actions action = new Actions(Browser.Browser.Instance);
action.DoubleClick(natAmount);
action.Perform();
Browser.Browser.Instance.FindElement(By.XPath("//form[@class='form-inline editableform']//input[@type='text']")).Clear();
Browser.Browser.Instance.FindElement(By.XPath("//form[@class='form-inline editableform']//input[@type='text']")).SendKeys(amount);
Browser.Browser.ClickByXPath("//button[@class='editable-submit ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only EMIRButtonStyle']");
Browser.Browser.ClickByID("EditValidateButton");
}
开发者ID:borisstoyanov,项目名称:FinancialRegulation-Selenium-Csharp,代码行数:12,代码来源:PO_EditEmirCollateralPage.cs
示例9: EditConfirmation
public void EditConfirmation(String amount)
{
Browser.Browser.ClickByXPath("//div[text()='Confirmation']");
IWebElement natAmount = Browser.Browser.Instance.FindElement(By.Id("50_Confirmation_ConfirmationMeans_InternalDiv"));
Actions action = new Actions(Browser.Browser.Instance);
action.DoubleClick(natAmount);
action.Perform();
Thread.Sleep(1000);
Browser.Browser.Instance.FindElement(By.XPath("//form[@class='form-inline editableform']//input[@type='text']")).Clear();
Thread.Sleep(1000);
Browser.Browser.Instance.FindElement(By.XPath("//form[@class='form-inline editableform']//input[@type='text']")).SendKeys(amount + Keys.Return);
Thread.Sleep(1000);
IWebElement submitBtn= Browser.Browser.Instance.FindElement(By.XPath("//button[@type='submit']"));
action.DoubleClick(submitBtn);
action.DoubleClick(submitBtn);
action.Perform();
Thread.Sleep(10000);
Browser.Browser.ClickByID("EditValidateButton");
}
开发者ID:borisstoyanov,项目名称:FinancialRegulation-Selenium-Csharp,代码行数:22,代码来源:PO_EditEmirTransactionPage.cs
示例10: EditClearing
public void EditClearing(String amount)
{
Browser.Browser.ClickByXPath("//div[text()='Clearing']");
IWebElement natAmount = Browser.Browser.Instance.FindElement(By.Id("60_Clearing_CentralCounterparty_ExternalDiv"));
IWebElement DateTimeStamp = Browser.Browser.Instance.FindElement(By.Id("60_Clearing_ClearingTimestamp_ExternalDiv"));
Actions action = new Actions(Browser.Browser.Instance);
action.DoubleClick(natAmount);
action.Perform();
Thread.Sleep(1000);
Browser.Browser.Instance.FindElement(By.XPath("//form[@class='form-inline editableform']//input[@type='text']")).SendKeys(amount);
Thread.Sleep(1000);
Browser.Browser.ClickByXPath("//button[@class='editable-submit ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only EMIRButtonStyle']");
Thread.Sleep(1000);
IWebElement submitBtn = Browser.Browser.Instance.FindElement(By.XPath("//button[@type='submit']"));
action.DoubleClick(submitBtn);
action.DoubleClick(submitBtn);
action.Perform();
Browser.Browser.ClickByID("EditValidateButton");
}
开发者ID:borisstoyanov,项目名称:FinancialRegulation-Selenium-Csharp,代码行数:22,代码来源:PO_EditEmirTransactionPage.cs
示例11: IfNoObjectInClipboardCtrlVRevertsToBrowserBehaviour
public virtual void IfNoObjectInClipboardCtrlVRevertsToBrowserBehaviour() {
GeminiUrl("home?m1=EmployeeRepository&d1=CreateNewEmployeeFromContact&f1_contactDetails=null");
WaitForView(Pane.Single, PaneType.Home);
var home = WaitForCss(".title");
Actions action = new Actions(br);
action.DoubleClick(home); //Should put "Home"into browser clipboard
action.SendKeys(Keys.Control + "c");
action.Perform();
Thread.Sleep(500);
//home.SendKeys(Keys.Control + "c");
string selector = "input.value";
var target = WaitForCss(selector);
Assert.AreEqual("", target.GetAttribute("value"));
target.Click();
target.SendKeys(Keys.Control + "v");
Assert.AreEqual("Home", target.GetAttribute("value"));
}
示例12: MouseActiveLeft
public void MouseActiveLeft(double left, double right, int shift)
{
Actions action = new Actions(Driver);
IWebElement axi = Driver.FindElement(By.Id("axis"));
(Driver as IJavaScriptExecutor).ExecuteScript("$(\"#axis\").axis(\"setRange\"," + left + "," + right + ");");
var before = (Driver as IJavaScriptExecutor).ExecuteScript("return $(\"#axis\").axis(\"getRange\");");
var bL = Convert.ToDouble((before as Dictionary<string, object>)["left"]);
var bR = Convert.ToDouble((before as Dictionary<string, object>)["right"]);
action.Build();
action.DragAndDropToOffset(axi, -shift, 0);
action.Perform();
var after = (Driver as IJavaScriptExecutor).ExecuteScript("return $(\"#axis\").axis(\"getRange\");");
var aL = Convert.ToDouble((after as Dictionary<string, object>)["left"]);
var aR = Convert.ToDouble((after as Dictionary<string, object>)["right"]);
Assert.IsTrue(aL > bL && aR > bR);
}
示例13: Click
/// <summary>
/// Method to click on button and Link
///
/// </summary>
public void Click(Dictionary<int, string> keyWordDic = null, string data = null)
{
try
{
_testObject = WaitAndGetElement();
DateTime startTime = DateTime.Now;
if (Utility.GetParameter("runbyevents").Equals("true"))
{
switch (Browser.BrowserName.ToLower())
{
case "ie":
case "iexplore":
ExecuteScript(_testObject, "arguments[0].click();");
try
{
WaitForObjectNotPresent(Utility.GetVariable("ObjectTimeout"),
Utility.GetVariable("GlobalTimeout"), keyWordDic);
}
catch
{
//Nothing to throw in this case
}
break;
default:
_testObject.Click();
break;
}
}
else
{
try
{
// Perform Shift+Click only if Shift key is passed as Data for action sheet data in case Chrome.
if ("Shift".Equals(data, StringComparison.OrdinalIgnoreCase) && Browser.BrowserName.Equals(KryptonConstants.BROWSER_CHROME, StringComparison.OrdinalIgnoreCase))
{
Actions objAction = new Actions(Driver);
objAction = objAction.KeyDown(Keys.Shift).Click(_testObject).KeyUp(Keys.Shift);
objAction.Build();
objAction.Perform();
}
else
{
_testObject.Click();
}
// Pause here for .5 sec as on mac safari VerifyTextOnPage after this looks at the page click is on and assumes that page has been received from server
// find a better way to do this
if (Browser.BrowserName.Equals("safari"))
Thread.Sleep(2000);
}
catch (ElementNotVisibleException enve)
{
try { ExecuteScript(_testObject, "arguments[0].click();"); }
catch { throw enve; }
}
catch (Exception e)
{
if (e.Message.ToLower().Contains(Exceptions.ERROR_NORESPONSEURL))
{
_testObject.Click();
}
else
{
throw;
}
}
}
//measure total time and raise exception if timeout is more than the allowed limit
DateTime finishTime = DateTime.Now;
double totalTime = (finishTime - startTime).TotalSeconds;
if (keyWordDic != null)
foreach (string modifiervalue in keyWordDic.Values)
{
if (modifiervalue.ToLower().Contains("timeout="))
{
double timeout = double.Parse(modifiervalue.Split('=').Last());
if (totalTime > timeout)
{
throw new Exception("Page load took " + totalTime.ToString(CultureInfo.InvariantCulture) + " seconds to load against expected time of " + timeout + " seconds.");
}
Property.Remarks = "Page load took " + totalTime.ToString(CultureInfo.InvariantCulture) + " seconds to load against expected time of " + timeout + " seconds.";
}
}
}
catch (Exception e)
{
if (_objDataRow.ContainsKey(KryptonConstants.TEST_OBJECT))
{
KryptonException.Writeexception(e);
throw new NoSuchElementException(Utility.GetCommonMsgVariable("KRYPTONERRCODE0067").Replace("{MSG3}", _objDataRow[KryptonConstants.TEST_OBJECT]).Replace("{MSG4}", _objDataRow["parent"]).Replace("{MSG1}", AttributeType).Replace("{MSG2}", Attribute).Replace("{ErrorMsg}", e.Message)); // added by
}
throw;
}
//.........这里部分代码省略.........
示例14: doubleClick
public static void doubleClick(this IWebDriver driver, string When, string How)
{
IWebElement ele = driver._FindElement(When, How);
Actions action = new Actions(driver);
action.DoubleClick();
action.Perform();
}
示例15: ToggleNavigationPan
static void ToggleNavigationPan()
{
var span = driver.FindElement(By.XPath("//div[@id='applicationContainer']//div[@id='/episerver/commerce/catalog_rootContainer']//div[@class='dijit epi-globalToolbar dijitToolbar']//span[@class='dijitReset dijitInline dijitButtonNode']"), 5);
var actionPan = new Actions(driver);
actionPan.MoveToElement(span);
actionPan.Click();
actionPan.Perform();
var pin = driver.FindElement(
By.XPath(
"//div[@id='navigation']//div[@class='epi-pinnableToolbar']//div[@class='epi-toolbarGroup epi-toolbarTrailing']/span[2]//span[@class='dijitReset dijitInline dijitButtonNode']"), 5);
var actionPin = new Actions(driver);
actionPin.MoveToElement(pin);
actionPin.Click();
actionPin.Perform();
}