Created
July 17, 2016 18:34
-
-
Save simpleprogrammer-shared/156bcd80b4abb189900d9adeb501adba to your computer and use it in GitHub Desktop.
Parallel Testing With Selenium Webdriver - Automation on Steroids 3
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
using System; | |
using NUnit.Framework; | |
using OpenQA.Selenium; | |
using OpenQA.Selenium.Remote; | |
namespace ParallelTestingBrowserStack | |
{ | |
[TestFixture] | |
[Parallelizable] | |
public class BrowserstackTest1 | |
{ | |
private IWebDriver _driver; | |
[SetUp] | |
public void Init() | |
{ | |
DesiredCapabilities capability = DesiredCapabilities.Firefox(); | |
capability.SetCapability("browserstack.user", Environment.GetEnvironmentVariable("BROWSERSTACK_USER", EnvironmentVariableTarget.User)); | |
capability.SetCapability("browserstack.key", Environment.GetEnvironmentVariable("BROWSERSTACK_KEY", EnvironmentVariableTarget.User)); | |
capability.SetCapability("browser", "Safari"); | |
capability.SetCapability("browser_version", "5.1"); | |
capability.SetCapability("os", "OS X"); | |
capability.SetCapability("os_version", "Snow Leopard"); | |
capability.SetCapability("resolution", "1024x768"); | |
_driver = new RemoteWebDriver( | |
new Uri("http://hub.browserstack.com/wd/hub/"), capability | |
); | |
} | |
[Test] | |
public void BrowserStackTest01() | |
{ | |
_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