Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simpleprogrammer-shared/156bcd80b4abb189900d9adeb501adba to your computer and use it in GitHub Desktop.
Save simpleprogrammer-shared/156bcd80b4abb189900d9adeb501adba to your computer and use it in GitHub Desktop.
Parallel Testing With Selenium Webdriver - Automation on Steroids 3
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