Created
July 2, 2017 18:54
-
-
Save angelovstanton/b09a76712966effad1436c2b850eba3a 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
public class AutomateThePlanetTestsXUnit | |
{ | |
[Fact] | |
public void TestWithFirefoxDriver() | |
{ | |
using (var driver = new FirefoxDriver()) | |
{ | |
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(); | |
} | |
} | |
[Fact] | |
public void TestWithEdgeDriver() | |
{ | |
using (var driver = new EdgeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))) | |
{ | |
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(); | |
} | |
} | |
[Fact] | |
public void TestWithChromeDriver() | |
{ | |
using (var driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))) | |
{ | |
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(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment