browsermob-proxy-py icon indicating copy to clipboard operation
browsermob-proxy-py copied to clipboard

This method has been deprecated. Please pass in the proxy object to the Driver Object

Open lihaoaini2008 opened this issue 4 years ago • 2 comments

browsermob-proxy-2.1.4, python 3.7
Tips: DeprecationWarning: This method has been deprecated. Please pass in the proxy object to the Driver Object profile.set_proxy(proxy.selenium_proxy()) What should I do Thank‘s!!!

lihaoaini2008 avatar May 05 '20 07:05 lihaoaini2008

Yes I have the same problem on this line:

profile.set_proxy(proxy.selenium_proxy())

alex4200 avatar Dec 04 '20 12:12 alex4200

Try my version Firefox 88.0.1 Python 3.9 browsermob-proxy 0.8.0

from browsermobproxy import Server
server = Server("path/to/browsermob-proxy")
server.start()
time.sleep(1)
proxy = server.create_proxy()
time.sleep(1)

from selenium import webdriver
proxy_firefox = proxy.proxy
caps = webdriver.DesiredCapabilities.FIREFOX
caps['marionette'] = True
caps['proxy'] = {
    "proxyType": "MANUAL",
    "httpProxy": proxy_firefox,
    "ftpProxy": proxy_firefox,
    "sslProxy": proxy_firefox
}
driver = webdriver.Firefox(capabilities=caps)
...
result = json.dumps(proxy.har.get('log'), ensure_ascii=False)     # proxy.har.get('log')
...
server.stop()
time.sleep(1)
driver.quit()                                                            # закрываем окно браузера
time.sleep(1)

Serg123-ent avatar May 21 '21 23:05 Serg123-ent