Merhabalar arkadaşlar ben bir program yaptım tek sorun selenium hatalarından kaçmayı beceremedim kodu ve hatayı atıyorum şimdiden yardımlarınız için teşekkür ederim.
HATA :
Traceback (most recent call last):
File "/home/barron4335/anaconda3/lib/python3.9/threading.py", line 980, in _bootstrap_inner
self.run()
File "/home/barron4335/anaconda3/lib/python3.9/threading.py", line 917, in run
self._target(*self._args, **self._kwargs)
File "/home/barron4335/Masaüstü/rdphack/anaprogram.py", line 247, in <lambda>
thread = Thread(target=lambda: self.startbots(i, int(ktekrarsayi), x, y))#, args=(i, int(ktekrarsayi), x, y))
File "/home/barron4335/Masaüstü/rdphack/anaprogram.py", line 410, in startbots
self.driver.close()
File "/home/barron4335/anaconda3/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 688, in close
self.execute(Command.CLOSE)
File "/home/barron4335/anaconda3/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/home/barron4335/anaconda3/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidSessionIdException: Message: invalid session id
Kod :
for i in range(0, ktekrarsayi):
try:
# Daha Çok Kazanç Elde Etmek İçin '#' işaretini kaldırmanız gerekmektedir
# dkansn = [[15, 900], [30, 1800], [60, 3600],
# [90, 5400], [120, 7200], [150, 9000]]
# dksn = dkansn[randint(0,6)]
# self.dk = dksn[0]
# sn = dksn[1]
# Daha Çok Kazan Elde etmek için 370-372 satırların önüne '#' işareti koyunuz
dkansn = [15, 900]
self.dk = dkansn[0]
sn = dkansn[1]
label3sonuc.config(text=f"{self.dk} Sonra yeniden başlayacak", bg="#fff", fg="black", font=("Ubuntu", 9, "bold"))
url = self.urlList[randint(0, len(self.urlList) + 2)]
label1sonuc.config(text=f"{url}", bg="#fff", fg="black", font=("Ubuntu", 9, "bold"))
ip = self.proxyList[randint(0, len(self.proxyList) + 2)]
label2sonuc.config(text=f"{ip}", bg="#fff", fg="black", font=("Ubuntu", 9, "bold"))
pencere1.update()
# firefox_capabilities = webdriver.DesiredCapabilities.FIREFOX
# firefox_capabilities['marionette'] = True
#
# firefox_capabilities['proxy'] = {
# "proxyType": "MANUAL",
# "httpProxy": ip,
# "ftpProxy": ip,
# "sslProxy": ip
# }
#
# options = Options()
# options.headless = False
# options = options
#
# driver = webdriver.Firefox(capabilities=firefox_capabilities)
# prox = Proxy()
# prox.proxy_type = ProxyType.MANUAL
# prox.http_proxy = ip
# prox.socks_proxy = ip
# # prox.ssl_proxy = ip
# capabilities = webdriver.DesiredCapabilities.CHROME
# prox.add_to_capabilities(capabilities)
# desired_capabilities = capabilities
chrome_options = Options()
chrome_options.add_argument(f'--proxy-server=http://{ip}')
chrome_options.add_extension('adblock.xpi')
self.driver = webdriver.Chrome(executable_path='chromedriver', chrome_options=chrome_options)
try:
# extension_path = "adblock.xpi"
# driver.install_addon(extension_path, temporary=True)
time.sleep(5)
self.driver.set_page_load_timeout(30)
self.driver.get("%s" % url)
time.sleep(sn)
self.bsayi += 1
self.openproxycreator(ip)
pencere1.update()
self.driver.close()
except selenium.common.exceptions.TimeoutException as ex:
print("Exception has been thrown. " + str(ex))
self.bsizsayi += 1
self.badproxycreator(ip)
self.driver.close()
continue
except selenium.common.exceptions.WebDriverException as ex:
print("Exception has been thrown. " + str(ex))
self.bsizsayi += 1
self.badproxycreator(ip)
self.driver.close()
continue
except selenium.common.exceptions.InvalidSessionIdException as ex:
print("Exception has been thrown. " + str(ex))
self.bsizsayi += 1
self.badproxycreator(ip)
self.driver.close()
continue
except http.client.RemoteDisconnected as ex:
print("Exception has been thrown. " + str(ex))
self.bsizsayi += 1
self.badproxycreator(ip)
self.driver.close()
continue
except urllib3.exceptions.NewConnectionError as ex:
print("Exception has been thrown. " + str(ex))
self.bsizsayi += 1
self.badproxycreator(ip)
self.driver.close()
continue
except ConnectionRefusedError as ex:
print("Exception has been thrown. " + str(ex))
self.bsizsayi += 1
self.badproxycreator(ip)
self.driver.close()
continue
except urllib3.exceptions.ProtocolError as ex:
print("Exception has been thrown. " + str(ex))
self.bsizsayi += 1
self.badproxycreator(ip)
self.driver.close()
continue
except urllib3.exceptions.MaxRetryError as ex:
print("Exception has been thrown. " + str(ex))
self.bsizsayi += 1
self.badproxycreator(ip)
self.driver.close()
continue
# except selenium.common.exceptions.WebDriverException as ex:
# print("Exception has been thrown. " + str(ex))
# self.bsizsayi += 1
# self.badproxycreator(ip)
# self.driver.close()
# continue
#
# except selenium.common.exceptions.InvalidSessionIdException as ex:
# print("Exception has been thrown. " + str(ex))
# self.bsizsayi += 1
# self.badproxycreator(ip)
# self.driver.close()
# continue
#
# except http.client.RemoteDisconnected as ex:
# print("Exception has been thrown. " + str(ex))
# self.bsizsayi += 1
# self.badproxycreator(ip)
# self.driver.close()
# continue
#
# except urllib3.exceptions.NewConnectionError as ex:
# print("Exception has been thrown. " + str(ex))
# self.bsizsayi += 1
# self.badproxycreator(ip)
# self.driver.close()
# continue
#
# except ConnectionRefusedError as ex:
# print("Exception has been thrown. " + str(ex))
# self.bsizsayi += 1
# self.badproxycreator(ip)
# self.driver.close()
# continue
#
# except urllib3.exceptions.ProtocolError as ex:
# print("Exception has been thrown. " + str(ex))
# self.bsizsayi += 1
# self.badproxycreator(ip)
# self.driver.close()
# continue
#
# except urllib3.exceptions.MaxRetryError as ex:
# print("Exception has been thrown. " + str(ex))
# self.bsizsayi += 1
# self.badproxycreator(ip)
# self.driver.close()
# continue