.NET Selenium (C#)
NET Selenium library by OpenQA is supported. You can define your authorization token indicating an extra capability of browsercloud.token
like in all our selenium integrations. You also need to take into account the fact that Chrome doesn't primarily recognize such a capability, so an error sign may occur. Make sure you set true
as your third argument.
Example
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Chrome;
namespace CloudSelenium
{
class Program
{
static void Main(string[] args)
{
IWebDriver driver;
ChromeOptions options = new ChromeOptions();
// Set launch args similar to puppeteer's for best performance
options.AddArgument("--disable-background-timer-throttling");
options.AddArgument("--disable-backgrounding-occluded-windows");
options.AddArgument("--disable-breakpad");
options.AddArgument("--disable-component-extensions-with-background-pages");
options.AddArgument("--disable-dev-shm-usage");
options.AddArgument("--disable-extensions");
options.AddArgument("--disable-features=TranslateUI,BlinkGenPropertyTrees");
options.AddArgument("--disable-ipc-flooding-protection");
options.AddArgument("--disable-renderer-backgrounding");
options.AddArgument("--enable-features=NetworkService,NetworkServiceInProcess");
options.AddArgument("--force-color-profile=srgb");
options.AddArgument("--hide-scrollbars");
options.AddArgument("--metrics-recording-only");
options.AddArgument("--mute-audio");
options.AddArgument("--headless");
options.AddArgument("--no-sandbox");
// Note we set our token here, with `true` as a third arg
options.AddAdditionalCapability("browsercloud.token", "YOUR-API-TOKEN", true);
driver = new RemoteWebDriver(
new Uri("https://chrome.browsercloud.io/webdriver"), options.ToCapabilities()
);
driver.Navigate().GoToUrl("https://example.com");
Console.WriteLine(driver.Title);
// Always call `quit` to ensure your session cleans up properly and you're not charged for unused time
driver.Quit();
}
}
}
You can use Go along with BrowserCloud despite the Title logoff from the Example website.
In case of any questions feel free to contact us: support@browsercloud.io