0

I tried to write a script to open chrome with authentication proxys, using selenium-wire. If I start the script, it stops immediately. No error code shows up but also no chrome (window) starts. What is the error/mistake I made. How can I fix it? My code is following:

import time

# Pfad zur Textdatei mit den Proxy-Daten
proxy_file_path = '/Pfad/zur/Datei/proxy.txt'  # Passe den Pfad an

# Lese die Proxy-Daten aus der Textdatei
with open(proxy_file_path, 'r') as proxy_file:
    proxy_lines = proxy_file.readlines()

# Iteriere durch die Proxy-Daten und verwende sie nacheinander
for line in proxy_lines:
    line = line.strip()
    if line:
        parts = line.split('@')
        if len(parts) == 2:
            proxy = {
                'https': f'https://{parts[0]}',
                'http': f'http://{parts[0]}',
                'no_proxy': 'localhost,127.0.0.1'
            }

            # Konfiguriere die Proxy-Optionen
            options = {
                'proxy': proxy
            }

            # Initialisiere den WebDriver mit den Proxy-Optionen
            driver = webdriver.Chrome(seleniumwire_options=options)

            driver.get('http://whatismyipaddress.com')

            time.sleep(7)

            # Schließe den Browser
            driver.quit()```
Luis
  • 11
  • 3
  • I didnt try your code, but just wanted to mention I once had this type of error with selenium where code was being run and executed but my window was just not showing the clicks and page loads on UI. I had a dump file so I could tell it was running and storing data properly. I ended up just trusting it was doing its thing. I think I moved to firefox after that – Raie Aug 25 '23 at 20:01
  • @Raie , yh, if i run the script without the .txt file, for example i put the proxys direct into the script, all works fine, chrome opens and stuff. But it didnt work since i switch to the thing with .txt file – Luis Aug 25 '23 at 20:24

0 Answers0