Selenium proxy setting for Chrome did not work

To set the proxy for Chrome using Selenium in C#, you can use the following code:

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;

var proxy = new Proxy
{
    Kind = ProxyKind.Manual,
    HttpProxy = "your_proxy:port",
    SslProxy = "your_proxy:port"
};

var options = new ChromeOptions();
options.Proxy = proxy;

var driver = new ChromeDriver(options)

Here, you create a Proxy object and set its HttpProxy and SslProxy properties to the host and port of your proxy server. Then, you create a ChromeOptions object and set its Proxy property to the Proxy object you just created. Finally, you create a ChromeDriver object and pass the ChromeOptions object to its constructor.

 

The proxy did not work, as Chrome is using proxy settings from your administrator

If you are seeing the message "Chrome is using proxy settings from your administrator" when trying to set the proxy settings in Selenium, it means that your Chrome browser is already configured to use a proxy server by your system administrator, and you won't be able to change the proxy settings using Selenium.

In this case, you have a few options:

  1. If you have access to the proxy server, you can try to configure it to allow traffic from your IP address without requiring authentication.

  2. You can try running your Selenium script on a machine that doesn't have a proxy configured in the system settings.

  3. You can try using a different browser or browser profile that doesn't have a proxy configured.

  4. You can contact your system administrator and ask them to either allow you to change the proxy settings or to provide you with a different IP address that is not restricted by the proxy server.

But there is no exception or warning from Selenium, I find this message from Chrome setting

If you're not seeing any exceptions or warnings in Selenium, but you're seeing the "using proxy settings from your administrator" message in Chrome, it's possible that the proxy settings are being set correctly in your Selenium code, but that there's another issue preventing Chrome from using them.

One possibility is that there are other proxy settings configured on your system that are taking precedence over the settings you're setting in your Selenium code. For example, if you're using a corporate network, there may be group policy settings or other network settings that are overriding your browser's proxy settings.

Another possibility is that your Chrome browser is using a different user profile than the one you're specifying in your Selenium code, and the proxy settings are set differently in that profile. You can check which profile Chrome is using by typing "chrome://version" into the address bar, and then looking for the "Profile Path" field.

To ensure that your proxy settings are being applied correctly, you can try running your Selenium code on a different machine or network to see if the issue persists. You can also try using a different browser, such as Firefox or Edge, to see if the issue is specific to Chrome. Finally, you can check with your system administrator or IT department to see if there are any network or proxy settings that might be affecting your browser's behavior.

 

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(54)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2022-02-17 Application Insights overview
2022-02-17 Using serilog with azure application insights and .Net core
2016-02-17 How to: Synchronize Files by Using Managed Code
2016-02-17 Getting Started Synchronizing Files
2016-02-17 Introducing Microsoft Sync Framework: Sync Services for File Systems
2013-02-17 Lingo软件的使用
点击右上角即可分享
微信分享提示