簡體   English   中英

在 Selenium Firefox 中將默認設置設置為“無代理”

[英]Setting default setting to 'no proxy' in Selenium Firefox

每當我使用命令在 python 中使用 Selenium 打開 Firefox 時

browser = webdriver.Firefox()

默認代理配置設置為“使用系統代理設置”。 我沒有在系統中配置任何代理。 無論何時打開瀏覽器,它都會顯示“代理服務器拒絕連接”。

如何打開瀏覽器以便將默認代理設置設置為“無代理”?

請幫忙。 提前致謝。

我會根據我的記憶發帖

import os
from selenium import webdriver

profile = webdriver.FirefoxProfile()
profile.set_preference('network.proxy.Kind','Direct')
webdriver.Firefox(profile)

要使用默認配置文件,您必須指定它

profile = webdriver.FirefoxProfile(path_to_profile_in_your_pc)
webdriver.Firefox(profile)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM