Ask Your Question
0

How can I configure Chrome to UK BST in Azure Pipeline using C# and Selenium?

asked 2023-05-22 21:01:21 +0000

huitzilopochtli gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-05-22 21:07:02 +0000

devzero gravatar image

To configure Chrome to UK BST in Azure Pipeline using C# and Selenium, you can use the following code:

ChromeOptions options = new ChromeOptions();
options.AddArguments("--no-sandbox");
options.AddArguments("--disable-dev-shm-usage");
options.AddArguments("--disable-gpu");
options.AddArguments("--headless");
options.AddArguments("--disable-setuid-sandbox");
options.AddArguments("--dns-prefetch-disable");
options.AddArguments("--lang=en-gb");
options.AddArguments("--disable-extensions");
options.AddArguments("--disable-popup-blocking");
options.AddArguments("--window-size=1920x1080");
options.AddArguments($"--user-data-dir={chromeUserData}");

TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time");
options.AddArguments($"--disable-time-zone-support=false");
options.AddArguments($"--disable-infobars");
options.AddArguments($"--start-maximized");
options.AddArguments($"--disable-features=LanguageEnforcement");
options.AddArguments($"--disable-features=NetworkService");
options.AddArguments($"--disable-features=VizDisplayCompositor");
options.AddArguments($"--disable-features=RendererCodeIntegrity");
options.AddArguments($"--timezone-id={tzi.Id}");
IWebDriver driver = new ChromeDriver(ChromeDriverService.CreateDefaultService(), options);

This code sets various Chrome options, including setting the language to UK English (--lang=en-gb) and setting the timezone to GMT Standard Time (--timezone-id={tzi.Id}). It then creates a new ChromeDriver with these options.

Note that you may need to change the timezone ID ("GMT Standard Time") to a different ID depending on your specific needs. You can find a list of valid timezone IDs in the Microsoft documentation.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-22 21:01:21 +0000

Seen: 19 times

Last updated: May 22 '23