Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97762

handshake failed; returned -1, ssl error code 1, net_error -202

$
0
0

I am trying to add an auth proxy on each browser window that i open up using user input but i get these errors...

[20792:21516:1222/011708.284:ERROR:ssl_client_socket_impl.cc(935)] handshake failed; returned -1, SSL error code 1, net_error -202
DEBUG:seleniumwire.proxy.handler:accounts.google.com:443 200

I have logging enabled and i'm seeing that i'm not even using the proxy i imported from my .txt file based on the log it gives...

7.0.0.1:50988", "noProxy": ""}, "acceptInsecureCerts": true}}, "desiredCapabilities": {"browserName": "chrome", "version": "", "platform": "ANY", "proxy": {"proxyType": "manual", "httpProxy": "127.0.0.1:50988", "sslProxy": "127.0.0.1:50988", "noProxy": ""}, "acceptIns
ecureCerts": true}}

For instance, if the user inputs 1, then 1 window with a proxy from the proxy list, "proxies.txt," will be opened up.

Here is my full code.

from seleniumwire import webdriver
from selenium.webdriver.chrome.options import Options
import logging
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from fake_useragent import UserAgent
import time
import random
from bs4 import BeautifulSoup

logging.basicConfig(level=logging.DEBUG)
chrome_path = r"chromedriver.exe"
times = ""
start_page = ""
settings = Options()
# proxy = Proxy()
pro_sheet = open("proxies.txt", "r")
new_proxy = []

for line in pro_sheet:
    new_proxy.append(line)


def start_pages(target_page):
    new = []
    ip = ''
    port = ''
    username = ''
    password = ''
    j = 0
    for x in range(0, len(page_number)):
        j = j + 1
        time.sleep(3)
        print("Attempting to add fake userAgent...")
        ua = UserAgent()
        user_agent = ua.random
        print("Successfully added fake userAgent...")
        time.sleep(1)
        print("Attempting to add capabilities and chrome options...")
        settings.add_argument(f'user-agent={user_agent}')
        settings.add_experimental_option("detach", True)
        settings.add_argument("window-size=600,600")
        settings.add_argument('--disable-extensions')
        settings.add_argument('--profile-directory=Default')
        settings.add_argument("--disable-plugins-discovery")
        settings.add_argument("--proxy-server=%s" % random.choice(*new_proxy))
        settings.add_argument("ignore-certificate-errors-spki-list")
        print("Successfully added chrome arguments and capabilities/options...")
        print("Attempting to detach chrome...")
        settings.add_experimental_option("detach", True)
        print("Successfully Detached chrome...")
        time.sleep(1)

        # print("Attempting to to initiate headless mode")
        # chrome_options.add_argument("--headless")
        # print('Initiated headless mode')

        print("Attempting to add proxy...")
        time.sleep(1)

        for p in range(len(new_proxy)):
            new = new_proxy[p]
            # print(new)
        n_p = new.split(':')
        for b in range(0, len(n_p)):
            ip = n_p[0]
            port = n_p[1]
            username = n_p[2]
            password = n_p[3]

        options = {
            'proxy': {
                'http': ip + ':' + port + ':' + username + ':' + password,
                'https': ip + ':' + port + ':' + username + ':' + password,
            }
        }
        driver = webdriver.Chrome(chrome_path, seleniumwire_options=options)
        driver.set_window_position(0, 0)
        time.sleep(1)
        print("Successfully added proxy...")
        print("Browser number " + str(j) + ", is using proxy: " + str(*new_proxy))

        time.sleep(1)

        print("Browser number " + str(j) + " has opened successfully...")


while times == "":
    times = input("How many pages do you want?\n")

# url = input("Yeezy Supply or Adidas?""\nEither 'YS' or 'Adidas'\n")
# url_choice = url.lower()

page_number = list()
for i in range(0, int(times)):
    page_number.append(times)

# if url_choice == 'ys':
# start_page = 'https://yeezysupply.com/'
# start_pages(start_page)
# elif url_choice == 'adidas':
# start_page = 'https://www.adidas.com/yeezy'
# start_pages(start_page)
start_page: str = 'https://www.adidas.com/yeezy'
start_pages(start_page)

Viewing all articles
Browse latest Browse all 97762

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>