ultrafunkamsterdam / undetected-chromedriver

Custom Selenium Chromedriver | Zero-Config | Passes ALL bot mitigation systems (like Distil / Imperva/ Datadadome / CloudFlare IUAM)
https://github.com/UltrafunkAmsterdam/undetected-chromedriver
GNU General Public License v3.0
9.71k stars 1.14k forks source link

Unable to launch multiple chrome browser at the same time. #906

Open jasonchong3329 opened 1 year ago

jasonchong3329 commented 1 year ago

Dear developer,

Anyone facing this issue before?

when I try launch the multiple chrome browser at the same time but have only 1 browser success launch , another browser will have error : selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:45655

[Update] After check seem like only certain website blocked multiple launch the same website at the same time.

below is my chrome options :

chrome_options = Options()
ua = UserAgent()
userAgent = ua.random
chrome_options.add_argument(f'user-agent={userAgent}')
chrome_options.add_argument("--start-maximized")
chrome_options.add_argument("--headless")
chrome_options.add_argument('--no-proxy-server')
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-setuid-sandbox")
chrome_options.add_argument('--disable-blink-features=AutomationControlled')
chrome_options.add_argument('--no-first-run')

Any solutions would be greatly appreciated.

thank you

mdmintz commented 1 year ago

It can be done with SeleniumBase and pytest:

pip install seleniumbase

Then run the following with python:

import pytest
from parameterized import parameterized
from seleniumbase import BaseCase

class RepeatTests(BaseCase):
    @parameterized.expand([[]] * 4)
    def test_repeat_this_test_with_parameterized(self):
        self.open("https://nowsecure.nl")
        try:
            self.assert_text("OH YEAH, you passed!", "h1", timeout=6.75)
            self.post_message("Selenium wasn't detected!", duration=1.6)
            self._print("\n Success! Website did not detect Selenium! ")
        except Exception:
            self.fail('Selenium was detected! Try using: "pytest --uc"')

if __name__ == "__main__":
    pytest.main([__file__, "--uc", "-n=4"])

Or you can run the above using:

pytest --uc -n=4
jasonchong3329 commented 1 year ago

It can be done with SeleniumBase and pytest:

pip install seleniumbase

Then run the following with python:

import pytest
from parameterized import parameterized
from seleniumbase import BaseCase

class RepeatTests(BaseCase):
    @parameterized.expand([[]] * 4)
    def test_repeat_this_test_with_parameterized(self):
        self.open("https://nowsecure.nl")
        try:
            self.assert_text("OH YEAH, you passed!", "h1", timeout=6.75)
            self.post_message("Selenium wasn't detected!", duration=1.6)
            self._print("\n Success! Website did not detect Selenium! ")
        except Exception:
            self.fail('Selenium was detected! Try using: "pytest --uc"')

if __name__ == "__main__":
    pytest.main([__file__, "--uc", "-n=4"])

Or you can run the above using:

pytest --uc -n=4

I have tried seleniumbase , but seem like the website blocked . unable to do any action on the website. anyway thank for your help.