public void ScrollElement(string script) { // setup var driver = new MockWebDriver(); var element = driver.FindElement(MockBy.Positive()); // execute driver.ExecuteScript(script, element); // actuals var scrollTop = (string)driver.ExecuteScript("return arguments[0].scrollTop;", element); var scrollLeft = (string)driver.ExecuteScript("return arguments[0].scrollLeft;", element); // assert Assert.IsTrue(scrollLeft == "400"); Assert.IsTrue(scrollTop == "500"); }
public void ScriptElementPositive() { // setup var driver = new MockWebDriver(); // execute driver.ExecuteScript("arguments[0].checked=false"); // assert Assert.IsTrue(true); }
public void OuterHtml(string script) { // setup var driver = new MockWebDriver(); // setup var actual = driver.ExecuteScript(script).ToString(); // assertion (expected exception) Assert.IsTrue(!string.IsNullOrEmpty(actual)); }
public void ScrollWindow(string script) { // setup var driver = new MockWebDriver(); // execute driver.ExecuteScript(script); // assert Assert.IsTrue(driver.Manage().Window.Position.Y == 500); Assert.IsTrue(driver.Manage().Window.Position.X == 400); }
public void NewTab(string script) { // setup var driver = new MockWebDriver(); var expected = driver.WindowHandles.Count + 1; // execute driver.ExecuteScript(script); // assert Assert.AreEqual(expected, actual: driver.WindowHandles.Count); }