Fehler beim Drehen von Proxy -Selenium -Webdriver -Nachricht: Ungültiges Argument: Nicht erkannte Fähigkeit: AkzeptiertS

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Fehler beim Drehen von Proxy -Selenium -Webdriver -Nachricht: Ungültiges Argument: Nicht erkannte Fähigkeit: AkzeptiertS

by Anonymous » 23 Feb 2025, 15:30

Bitte helfen Sie mir, diesen Fehler zu lösen. Ich möchte mit Selenium Webdriver und rotierenden Proxy abkratzen, aber ich weiß nicht, was die richtige Konfiguration für das Seting Proxy ist und diesen Fehler erhalten hat. Wie mache ich das?from selenium import webdriver
import time
import requests
from bs4 import BeautifulSoup

PATH = r'chromedriver.exe'

def listProxies():
"""Get List of Free Proxy."""
r = requests.get('https://free-proxy-list.net/')
soup = BeautifulSoup(r.content, 'html.parser')
table = soup.find('tbody')

proxies = []
for row in table:
if row.find_all('td')[4].text == 'elite proxy':
proxy = ':'.join([row.find_all('td')[0].text, row.find_all('td')[1].text])
proxies.append(proxy)
else:
pass
return proxies

def getProxy(prox):
proxy = {"http": f"http://{prox}",
"https": f"http://{prox}"
}
return proxy

def getProx():
"""Choose and get available Proxy from list"""
proxies = listProxies()
for prox in proxies:
# Free proxy (IP:PORT format from SSLProxies)
proxy = getProxy(prox)
try:
print(f"trying proxy:{proxy}...")
response = requests.get("http://httpbin.org/ip", proxies=proxy, timeout=5)
if response.status_code == 200:
print("Yay, its working! Proxy is working:", response.json()) # Should return the proxy's IP if working
return prox
else:
print("Proxy failed, switching...") # Get a new one
break
except requests.exceptions.RequestException as e:
print(f"Proxy failed: {e}. Trying another one")

def start_driver():
"""Starts Selenium WebDriver with a random proxy."""
prox = getProx() # (Update regularly or use a free-proxy)
proxy = getProxy(prox)
webdriver.DesiredCapabilities.CHROME['proxy'] = {
"httpProxy": prox,
"ftpProxy": prox,
"sslProxy": prox,
"proxyType": "MANUAL",
}
webdriver.DesiredCapabilities.CHROME['acceptSslCerts']=True
driver =webdriver.Chrome(service = webdriver.ChromeService(executable_path=PATH))
return driver

< /code>
Mein laufender Code < /p>
"""Running Code"""
try:
driver = start_driver()
driver.get("'http://whatismyipaddress.com'")
except Exception as e:
print(f"Proxy failed: {e}. Retrying with a new proxy...\n")
time.sleep(3) # Wait before retrying
print("Done.")
< /code>
, aber es gibt mir Fehlermeldung: < /p>

Message: invalid argument: unrecognized capability: acceptSslCerts Stacktrace:
GetHandleVerifier [0x00007FF7F3396EE5+28773]
(No symbol) [0x00007FF7F33025D0]
(No symbol) [0x00007FF7F3198FAA]...etc

< /code>
Ich benutze gerade kostenloser Proxy. Ist es immer noch möglich? Ich habe auch mein Selenium auf die neueste Version aktualisiert: 4.29.0 !

Top