Chromedriver如何添加引用标头C#

时间:2019-03-10 09:58:30

标签: c# selenium selenium-chromedriver

正在寻求有关如何在硒中设置引用标头的建议。

我当前的代码:

 ChromeOptions options = new ChromeOptions();
 var driverService = ChromeDriverService.CreateDefaultService();
 driverService.HideCommandPromptWindow = true;

 options.AddArgument("--log-level=3");
 //options.AddArgument("--headless");
 options.AddArgument("ignore-certificate-errors");
 options.AddArgument("--user-agent=Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25");

 //proxy
 Random rnd = new Random();
 int num = rnd.Next(0, 10);

 string[] proxy = File.ReadLines("proxies.txt").ToArray();
 options.AddArguments("--proxy-server=http://" + proxy[rnd.Next(0, proxy.Length)]);

谢谢!

0 个答案:

没有答案