本文整理汇总了C#中Manager.Sniffify方法的典型用法代码示例。如果您正苦于以下问题:C# Manager.Sniffify方法的具体用法?C# Manager.Sniffify怎么用?C# Manager.Sniffify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manager
的用法示例。
在下文中一共展示了Manager.Sniffify方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestMethod1
public void TestMethod1()
{
// setup
driver.Navigate().GoToUrl(exmampleUrl);
Manager manager = new Manager(driver);
string a = "3";
string b = "7";
// execute
Sniff sniff = manager.Sniffify("window", "multiply", "window_multiply", "function() { console.log('log from custom function');}");
driver.FindElement(By.Id("a")).Clear();
driver.FindElement(By.Id("a")).SendKeys(a);
driver.FindElement(By.Id("b")).Clear();
driver.FindElement(By.Id("b")).SendKeys(b);
driver.FindElement(By.Id("execute")).Click();
driver.FindElement(By.Id("execute")).Click();
var invocations = sniff.GetInvocations("window_multiply");
var lastInvocation = sniff.GetLastInvocation("window_multiply");
var parameters = manager.GetLastInvocationParams("window_multiply");
// expect
Assert.AreEqual(invocations.Length, 2);
Assert.AreEqual(lastInvocation.ExecutionParameters["a"], a, "last invocation a value is incorrect");
Assert.AreEqual(lastInvocation.ExecutionParameters["b"], b, "last invocation b value is incorrect");
Assert.AreEqual(parameters["a"], a,"parameters a value is incorrect");
Assert.AreEqual(parameters["b"], b,"parameters b value is incorrect");
Assert.IsTrue(lastInvocation.Duration > 0);
}