This file contains hidden or 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
| # assume "element" is a properly found WebElement instance, | |
| # "wait" is a properly constructed WebDriverWait instance, | |
| # and "driver is the proper WebDriver instance. | |
| original_handle = driver.current_window_handle | |
| original_handle_list = driver.window_handles | |
| element.click() | |
| wait.until(expected_conditions.new_window_is_opened(original_handles)) | |
| new_handle_list = driver.window_handles | |
| window_handle_difference = list(set(new_handle_list) - set(original_handle_list)) | |
| new_window_handle = window_handle_difference[0] |
This file contains hidden or 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 bool IsVisible | |
| { | |
| get | |
| { | |
| try | |
| { | |
| WebDriverWait wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(3)); | |
| ActiveCompaniesGrid = wait.Until(d => d.FindElement(ActiveCompaniesGridId)); | |
| return ActiveCompaniesGrid.Displayed; | |
| } |
This file contains hidden or 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
| REM Tested and confirmed to work on a newly-installed Windows 10 Professional Build 1909 | |
| DISM /Online /Add-Capability /CapabilityName:Tools.DeveloperMode.Core~~~~0.0.1.0 | |
| reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowAllTrustedApps" /d "1" | |
| reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1" | |
| powershell -NoProfile -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" | |
| choco install -y git | |
| choco install -y openjdk11 | |
| choco install -y python | |
| choco install -y visualstudio2019community --params "--add Microsoft.VisualStudio.Workload.ManagedDesktop;includeRecommended --add Microsoft.Net.Component.4.6.2.TargetingPack --add Microsoft.Net.Component.4.7.1.TargetingPack --add Micr |
This file contains hidden or 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
| def _library_impl(ctx): | |
| providers = {} | |
| stdrefs = [ctx.attr._stdrefs] if ctx.attr.include_stdrefs else [] | |
| for tfm in ctx.attr.target_frameworks: | |
| providers[tfm] = AssemblyAction( | |
| ctx.actions, | |
| name = ctx.attr.name, | |
| additionalfiles = ctx.files.additionalfiles, |
This file contains hidden or 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
| void SaveSnapshot(const std::string& base64_encoded_image) { | |
| std::vector<BYTE> buffer(base64_encoded_image.size()); | |
| int len = buffer.size(); | |
| ::Base64Decode(base64_encoded_image.c_str(), | |
| base64_encoded_image.size(), | |
| &buffer[0], | |
| &len); | |
| HGLOBAL hMem = ::GlobalAlloc(GMEM_MOVEABLE, len); | |
| LPVOID pImage = ::GlobalLock(hMem); |
This file contains hidden or 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
| std::wstring script = L""; | |
| //script.append(L"browser.result = browser.executeScript(\""); | |
| //script.append(L"(function() { "); | |
| //script.append(script_source); | |
| //script.append(L" }).apply(window, [])"); | |
| //script.append(L"\");"); | |
| //script.append(L"\nexternal.sendMessage('debug', JSON.stringify(browser.webdriver.known));"); | |
| //script.append(L"\nexternal.sendMessage('script', JSON.stringify(browser.result));"); | |
| //script.append(L"browser.scriptContext = dom.getCrossSiteWindow(browser.document.parentWindow, browser.document.parentWindow);"); | |
| script.append(L"browser.context = browser.executeScript(\"window;\""); |
This file contains hidden or 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.Collections.Generic; | |
| namespace BrowserStack | |
| { | |
| /// <summary> | |
| /// This class defines the Chrome-specific options that can be set for a BrowserStack session. | |
| /// </summary> | |
| public class BrowserStackChromeOptions | |
| { | |
| private static readonly string DriverVersionOptionName = "driver"; |
This file contains hidden or 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
| SauceLabsSessionOptions sauceOptions = new SauceLabsSessionOptions(); | |
| sauceOptions.UserName = "username"; | |
| sauceOptions.AccessKey = "accessKey"; | |
| ChromeOptions options = new ChromeOptions(); | |
| options.AddAdditionalOption(SauceLabsSessionOptions.SauceOptionsOptionName, sauceOptions.ToDictionary()); | |
| IWebDriver driver = new RemoteWebDriver(new Uri("https://ondemand.saucelabs.com/wd/hub"), options); |
This file contains hidden or 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
| Dictionary<string, object> browserStackOptions = new Dictionary<string, object>(); | |
| browserStackOptions.Add("os", "Windows"); | |
| browserStackOptions.Add("osVersion", "10"); | |
| browserStackOptions.Add("resolution", "1024x768"); | |
| browserStackOptions.Add("userName", "barancev"); | |
| browserStackOptions.Add("accessKey", "xxx"); | |
| browserStackOptions.Add("sessionName", "Bstack-[C_sharp] Sample Test"); | |
| ChromeOptions options = new ChromeOptions(); | |
| options.BrowserVersion = "62.0"; | |
| options.AddAdditionalOption("bstack:options", browserStackOptions); |
This file contains hidden or 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 ExtendedFirefoxDriver : FirefoxDriver | |
| { | |
| // NOTE: Add constructor overloads to support the instantiations your tests require. | |
| public ExtendedFirefoxDriver(string servicePath, FirefoxOptions options) : base(servicePath, options) | |
| { | |
| this.CommandExecutor.CommandInfoRepository.TryAddCommand("installAddOn", new CommandInfo(CommandInfo.PostCommand, "/session/{sessionId}/moz/addon/install")); | |
| } | |
| public void InstallAddOnFromFile(string addOnFileToInstall) | |
| { |