4

I am working on Selenium Tests (in c#, dotnetcore2.1) for our portal webpage. The system that is running the tests (and my dev vm) have got a proxy configured (Internet Explorer -> Settings -> Internet Options -> Connections -> LAN Settings -> Proxy Server). This proxy is required for accessing the outside, but it MUST NOT be used for the connection from the selenium client in the c# project to the chrome webdriver api (that is opened when executing the chromewebdriver.exe).

I already tried to add localhost to the "Do not use proxy server for addresses beginning with:" setting like this:

my.domain;localhost

but it still cannot connect to the chromedriver. If i disable the proxy, the connection to the chromedriver is not a problem.

I do not want to configure a proxy, that chrome is supposed to use, but I want to configure "no proxy" for the connection to the chromewebdriver itself. Anybody any ideas? I get tons of hits on google but they all describe how to configure the proxy for chrome itself.

To clearify my request. My c# snippet looks like this:

using(var driver = new ChromeDriver(".") {
    driver.Navigate().GoToUrl("...");
}

Selenium.WebDriver and Selenium.WebDriver.ChromeDriver are installed via NuGet.

Woozar
  • 1,000
  • 2
  • 11
  • 35
  • 1
    To clarify: You want to connect to an existing chromedriver using Selenium. Correct? – ojonasplima Dec 29 '21 at 13:52
  • i want to start a new ChromeDriver from my code. (I updated the original question) – Woozar Dec 29 '21 at 14:38
  • You'll need to use the chrome flags to work on that. Do you have knowledge on how to use them? It's the --proxy-server="socks://localhost:8080". If you wanna try it, just type on your prompt: `start chrome --proxy-server="socks://localhost:8080"` Edit: On you driver, you'll add: `chromeOptions = ChromeOptions()` `chromeOptions.AddArgument('--proxy-server=' + [proxyhere])` – ojonasplima Dec 29 '21 at 14:45
  • but this will tell chrome which proxy to use and not the c# assembly which proxy to use when trying to start the chromedriver, right? The proxy inside chrome is working properly, but I cannot get the test assembly to access the chromedriver (probably via some chromedriver api) – Woozar Dec 29 '21 at 14:54
  • 1
    Now I got you. Can't figure out something to work on but the situation happens on the initialisation of the driver, for that I'd suggest to look on the method/constructor `ChromeDriverService​`. – ojonasplima Dec 29 '21 at 15:03
  • I already stumbled upon that. I will give it another look. Thanks for your help. – Woozar Dec 29 '21 at 15:07

0 Answers0