Created
February 23, 2016 13:54
-
-
Save nadvolod/2841fa4ccb24ac4b26ff to your computer and use it in GitHub Desktop.
Sample Selenium Webdriver test that is ready to be ran in BrowserStack in parallel mode.
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
[TestFixture] | |
[Parallelizable] | |
public class BrowserstackTest2 | |
{ | |
private IWebDriver driver; | |
[SetUp] | |
public void Init() | |
{ | |
DesiredCapabilities capability = DesiredCapabilities.Firefox(); | |
capability.SetCapability("browserstack.user", "YOUR USER NAME"); | |
capability.SetCapability("browserstack.key", "YOUR KEY VALUE HERE"); | |
capability.SetCapability("browser", "Edge"); | |
capability.SetCapability("browser_version", "13.0"); | |
capability.SetCapability("os", "Windows"); | |
capability.SetCapability("os_version", "10"); | |
capability.SetCapability("resolution", "1024x768"); | |
driver = new RemoteWebDriver( | |
new Uri("http://hub.browserstack.com/wd/hub/"), capability | |
); | |
} | |
[Test] | |
public void BrowserStackTest2() | |
{ | |
driver.Navigate().GoToUrl("http://www.qtptutorial.net/automation-practice"); | |
driver.Manage().Window.Maximize(); | |
driver.FindElement(By.Id("idExample")).Click(); | |
var elementCheck = driver.FindElement(By.XPath("//p[contains(text(),'Button success')]")).Displayed; | |
Assert.IsTrue(elementCheck, "Element was not present"); | |
} | |
[TearDown] | |
public void Cleanup() | |
{ | |
driver.Quit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment