Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lihaoaini2008 opened this issue May 5, 2020 · 2 comments

Comments

@lihaoaini2008
Copy link

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!!!

@alex4200
Copy link

alex4200 commented Dec 4, 2020

Yes I have the same problem on this line:

profile.set_proxy(proxy.selenium_proxy())

@Serg123-ent
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants