So I using Selenium Wire in Python in order to browse a website and at present my code is failing with the following error
ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -100'''
When I get this error Selenium seems to disconnect from the internet so subsequent clicks and interactions do not work. I had a look online and understand that I need to pass in the following arguments (Makes sense but correct me if I am wrong)
options.add_argument('--ignore-certificate-errors-spki-list')
options.add_argument('--ignore-ssl-errors').
I have the following code already which uses a proxy server but I am not sure how to pass the above argument into my current Selenium options with the proxy options already in place. I hope this makes sense?!
(I have changed my proxy server details for security reasons obvs).
Thanks!!!!!!
import selenium
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
url = 'http://www.whatsmyipaddress.com'
from seleniumwire import webdriver
options = {
'proxy': {
'http': 'http://myusername:[email protected]:123456',
'https': 'http://myusername:[email protected]:123456',
'no_proxy': 'localhost,127.0.0.1' # excludes
}
}
driver = webdriver.Chrome(executable_path=r"C:\Chrome\chromedriver.exe",
seleniumwire_options=options)
driver.get(url=url)
you should use seleniumwire_options
arg for proxy options and options
arg for the rest of your options.
code example:
from seleniumwire import webdriver
# selenium-wire proxy settings
options = {
'proxy': {
'http': 'http://myusername:[email protected]:123456',
'https': 'http://myusername:[email protected]:123456',
'no_proxy': 'localhost,127.0.0.1' # excludes
}
}
# other chrome options
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--ignore-certificate-errors-spki-list')
chrome_options.add_argument('--ignore-ssl-errors')
driver = webdriver.Chrome('chromedriver', options=chrome_options,seleniumwire_options=options)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With