Created
July 9, 2017 21:01
-
-
Save angelovstanton/d999032642e1404c1128e39f24f6e109 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void ScrollFocusToControl_InCloud_ShouldFail() | |
{ | |
_driver.Navigate().GoToUrl(@"https://automatetheplanet.com/compelling-sunday-14022016/"); | |
var link = _driver.FindElement(By.PartialLinkText("Previous post")); | |
var jsToBeExecuted = $"window.scroll(0, {link.Location.Y});"; | |
((IJavaScriptExecutor)_driver).ExecuteScript(jsToBeExecuted); | |
link.Click(); | |
Assert.AreEqual("10 Advanced WebDriver Tips and Tricks - Part 1", _driver.Title); | |
} | |
[Test] | |
public void ScrollFocusToControl_InCloud_ShouldPass() | |
{ | |
_driver.Navigate().GoToUrl(@"https://automatetheplanet.com/multiple-files-page-objects-item-templates/"); | |
var link = _driver.FindElement(By.PartialLinkText("TFS Test API")); | |
var jsToBeExecuted = $"window.scroll(0, {link.Location.Y});"; | |
((IJavaScriptExecutor)_driver).ExecuteScript(jsToBeExecuted); | |
var wait = new WebDriverWait(_driver, TimeSpan.FromMinutes(1)); | |
var clickableElement = wait.Until(ExpectedConditions.ElementToBeClickable(By.PartialLinkText("TFS Test API"))); | |
clickableElement.Click(); | |
Assert.AreEqual("TFS Test API Archives - Automate The Planet", _driver.Title); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment