Skip to content

Instantly share code, notes, and snippets.


Nikolay nikolay-advolodkin

  • Sauce Labs
View GitHub Profile
View AppiumError.cs
Test Name: SimpleTest
Test FullName: AppiumOnDotNetFramework.Rdc.SimpleTest
Test Source: C:\Source\SauceLabs\saucelabs-training\demo-csharp\demo-csharp\SauceExamples\AppiumOnDotNetFramework\Rdc.cs : line 20
Test Outcome: Failed
Test Duration: 0:00:39.0009266
Result StackTrace:
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
at OpenQA.Selenium.Appium.AppiumDriver`1..ctor(Uri remoteAddress, ICapabilities appiumOptions)
nikolay-advolodkin / SeleniumAutomation.yml
Last active Oct 26, 2018
YAML file for Selenium automation in Azure DevOps Pipelines
View SeleniumAutomation.yml
- repo: self
name: Hosted VS2017
- msbuild
- visualstudio
- vstest
nikolay-advolodkin / 2SCTunnels.ps1
Last active Oct 15, 2018
Running 2 sauce connect tunnels on a single VM for RDC on Windows
View 2SCTunnels.ps1
#Start the 1st tunnel
.\bin\sc.exe -i NikolaysTunnel2 -u nikolay-a -k CD7874C45DF24FDF -x h
#Start the 2nd tunnel and make sure that you specify the pidfile, logfile, and new port.
.\bin\sc.exe -i NikolaysTunnel2 -u nikolay-a -k CD7874C45DF24FDF -x h
ttps:// --pidfile .\ --logfile .\sc2.log -P 4446
View JITDataManagement.cs
public void JITData()
//we need a new test user so we create one
var amazonAPI = new AmazonAPI();
var testUser = amazonAPI.CreateUser("","Test12345*")
new AmazonLoginPage(Driver).Login(testUser).Should().BeTrue();
//we clean up after
public void tearDown(ITestResult result) throws Exception {
((JavascriptExecutor) webDriver.get()).
executeScript("sauce:job-result=" + (result.isSuccess() ? "passed" : "failed"));
//todo all other logic that you want to perform here should come after the 2 calls at the top
View caps.cs
Logger.Info(String.Format(Constants.logMsgStartFormat, TestContext.CurrentContext.Test.Name, DateTime.UtcNow));
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 |
SecurityProtocolType.Tls11 |
SecurityProtocolType.Tls |
DesiredCapabilities capabilities = new DesiredCapabilities();
//capabilities.SetCapability("device", TestPlatform);
capabilities.SetCapability("platformName", TestPlatform);
//capabilities.SetCapability("deviceOrientation", "portrait");
capabilities.SetCapability("platformVersion", TestPlatformVersion);
nikolay-advolodkin / Dialogs.cs
Created Oct 4, 2018
Handling selenium dialog boxes
View Dialogs.cs
var popup = Driver.SwitchTo().Alert();
nikolay-advolodkin / setSauceEnvVariables.ps1
Created Sep 23, 2018
Set sauce environment variables from .ps1 file
View setSauceEnvVariables.ps1
Write-Host "sauce.userName that was passed in from Azure DevOps=>$sauceUserName"
Write-Host "sauce.accessKey that was passed in from Azure DevOps=>$sauceAccessKey"
[Environment]::SetEnvironmentVariable("SAUCE_USERNAME", "$sauceUserName", "User")
[Environment]::SetEnvironmentVariable("SAUCE_ACCESS_KEY", "$sauceAccessKey)", "User")
View SeleniumRdcParallel.cs
//Must use Nunit
//Must update AssemblyInfo.cs to have this:
//[assembly: Parallelizable(ParallelScope.Fixtures)]
//[assembly: LevelOfParallelism(10)] [assembly: LevelOfParallelism(100)]
class ParallelTestsWithBestPractices
nikolay-advolodkin / ConfiguringChromeOptions.cs
Created Aug 24, 2018
How to set browerVersion and platformName for ChromeOptions
View ConfiguringChromeOptions.cs
ChromeOptions options = new ChromeOptions();
options.UseSpecCompliantProtocol = true;
options.BrowserVersion = "latest";
options.PlatformName = "Windows 10";
Driver = new RemoteWebDriver(new Uri(""), options.ToCapabilities(),