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
    
  
  
    
  | IJavaScriptEngine monitor = new JavaScriptEngine(driver); | |
| List<string> consoleMessages = new List<string>(); | |
| monitor.JavaScriptConsoleApiCalled += (sender, e) => | |
| { | |
| Console.WriteLine("Log: {0}", e.MessageContent); | |
| }; | |
| await monitor.StartEventMonitoring(); | 
  
    
      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
    
  
  
    
  | NetworkAuthenticationHandler handler = new NetworkAuthenticationHandler() | |
| { | |
| UriMatcher = (d) => d.Host.Contains("your-domain.com"), | |
| Credentials = new PasswordCredentials("admin", "password") | |
| }; | |
| INetwork networkInterceptor = driver.Manage().Network; | |
| networkInterceptor.AddAuthenticationHandler(handler); | |
| await networkInterceptor.StartMonitoring(); | 
  
    
      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 async Task TestNetworkInterceptor(IWebDriver driver) | |
| { | |
| NetworkRequestHandler handler = new NetworkRequestHandler() | |
| { | |
| RequestMatcher = (request) => | |
| { | |
| return request.Url.Contains("the-internet.herokuapp.com"); | |
| }, | |
| ResponseSupplier = (request) => | |
| { | 
  
    
      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
    
  
  
    
  | INetwork networkInterceptor = driver.Manage().Network; | |
| NetworkAuthenticationHandler handler = new NetworkAuthenticationHandler() | |
| { | |
| UriMatcher = (url) => url.Host == "the-internet.herokuapp.com" && url.PathAndQuery.Contains("basic_auth"), | |
| Credentials = new PasswordCredentials("admin", "admin") | |
| }; | |
| await networkInterceptor.StartMonitoring(); | |
| driver.Url = "http://the-internet.herokuapp.com/basic_auth"; | 
  
    
      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 _generate_devtools_impl(ctx): | |
| outdir = ctx.actions.declare_directory("generated") | |
| args = ctx.actions.args() | |
| args.add_all("-s", [ctx.attr.src.files]) | |
| args.add_all("-b", [ctx.attr.browser_protocol.files]) | |
| args.add_all("-j", [ctx.attr.js_protocol.files]) | |
| args.add_all("-t", [ctx.attr.template.files]) | |
| args.add_all("-o", [outdir]) | 
  
    
      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
    
  
  
    
  | import itertools | |
| riddler_township = {} | |
| total_population = 0 | |
| for shire_number in range(1, 11): | |
| shire_population = shire_number * 10 + 1 | |
| total_population += shire_population | |
| majority = shire_population // 2 + 1 | |
| electors = shire_number + 2 | |
| riddler_township[electors] = majority | 
  
    
      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
    
  
  
    
  | FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(); | |
| service.Host = "127.0.0.1"; | |
| IWebDriver driver = new FirefoxDriver(service); | 
  
    
      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 SeleniumSessionStarter | |
| { | |
| private string userName; | |
| private string password; | |
| private string domain; | |
| private string shouldLoadUserProfile; | |
| public SeleniumSessionStarter(string userName, string password, string domain, bool shouldLoadProfile) | |
| { | |
| this.userName = userName; | 
  
    
      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
    
  
  
    
  | // This sample assumes driver is a valid IWebDriver, and that | |
| // elementThatPopsUpNewTab is a valid, already located IWebElement | |
| // that, when clicked, follows a link that will open a new tab. | |
| IList<string> existingHandles = driver.WindowHandles; | |
| elementThatPopsUpNewTab.Click(); | |
| WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(5)); | |
| string newTabHandle = wait.Until<string>((d) => | |
| { | |
| string foundHandle = null; | |
| IList<string> differentHandles = d.WindowHandles.Except(existingHandles).ToList(); | 
  
    
      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
    
  
  
    
  | HttpCommandExecutor commandExecutor = new HttpCommandExecutor(new Uri("http://hub-cloud.browserstack.com/wd/hub/"), TimeSpan.FromSeconds(60)); | |
| commandExecutor.Proxy = new WebProxy("http://address:port", false); | |
| ChromeOptions options = new ChromeOptions(); | |
| options.AddAdditionalCapability("browser", "Chrome"); | |
| options.AddAdditionalCapability("browser_version", "80.0"); | |
| options.AddAdditionalCapability("os", "Windows"); | |
| options.AddAdditionalCapability("os_version", "10"); | |
| options.AddAdditionalCapability("resolution", "1024x768"); | |
| options.AddAdditionalCapability("browserstack.user", "user"); |