kaliiiiiiiiii / Selenium-Profiles

undetected Selenium using chromedriver and emulation / device profiles
Other
255 stars 29 forks source link

Can't seem to run default code #101

Closed AlexPaiva closed 10 months ago

AlexPaiva commented 10 months ago

Describe the bug Running the default below code return the below error message

To Reproduce

from selenium_profiles.webdriver import Chrome
from selenium_profiles.profiles import profiles
from selenium_driverless.webdriver import ChromeOptions
from selenium_driverless.types.by import By

profile = profiles.Windows()  # or .Android
options = ChromeOptions()
# options.add_argument("--headless=new")
driver = Chrome(profile, options=options, driverless_options=True)

# get url
driver.get('https://nowsecure.nl#relax')  # test fingerprint

driver.quit()  # Execute on the End!

Expected behavior or error-message Returns unexpected argument on options=options, then if I remove it on driverless_options=True, then if empty says it received 2 arguments but expected 1

Chrome.__init__() got an unexpected keyword argument

Environment (please complete the following information):

Aditional context From what I found here https://stackoverflow.com/questions/76550506/typeerror-webdriver-init-got-an-unexpected-keyword-argument-executable-p seems like it's related to the new selenium version? but UC works just fine, weird

kaliiiiiiiiii commented 10 months ago

@AlexPaiva please provide a traceback

Also, I can't reproduce this issue. Maybe execute the following and try again

pip install --upgrade selenium-driverless
pip install --upgrade selenium
pip install --upgrade selenium-profiles
AlexPaiva commented 10 months ago

Actually didn't show the same error now:

Traceback (most recent call last):
  File "C:\Users\AA\AppData\Local\Programs\Python\Python310\lib\site-packages\cdp_socket\scripts\abstract.py", line 23, in __anext__
    return await self._fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\AA\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 456, in wait_for
    return fut.result()
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\AA\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium_driverless\webdriver.py", line 292, in get
    await wait
  File "C:\Users\AA\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium_driverless\webdriver.py", line 1278, in wait_for_cdp
    return await socket.wait_for(event, timeout=timeout)
  File "C:\Users\AA\AppData\Local\Programs\Python\Python310\lib\site-packages\cdp_socket\socket.py", line 93, in wait_for
    raise e
  File "C:\Users\AA\AppData\Local\Programs\Python\Python310\lib\site-packages\cdp_socket\socket.py", line 88, in wait_for
    res = await asyncio.wait_for(_iter.__anext__(), timeout)
  File "C:\Users\AA\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 458, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\AA\Downloads\B\R\tester.py", line 4500, in signup
    future.result()
  File "C:\Users\AA\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py", line 446, in result
    return self.__get_result()
  File "C:\Users\AA\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py", line 391, in __get_result
    raise self._exception
  File "C:\Users\AA\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\AA\Downloads\B\R\tester.py", line 3313, in gamiCalli
    driver = Chrome(profile, options=options, driverless_options=True)
  File "C:\Users\AA\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium_profiles\webdriver.py", line 158, in __init__
    self.get("chrome://version/")  # wait browser to start
  File "C:\Users\AA\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium_driverless\sync\webdriver.py", line 53, in syncified
    return self._loop.run_until_complete(item(*args, **kwargs))
  File "C:\Users\AA\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
    return future.result()
  File "C:\Users\AA\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium_driverless\webdriver.py", line 294, in get
    raise TimeoutError(f"page didn't load within timeout of {self._page_load_timeout}")
TimeoutError: page didn't load within timeout of 30

Code:

        from selenium_profiles.webdriver import Chrome
        from selenium_profiles.profiles import profiles
        from selenium_driverless.webdriver import ChromeOptions
        from selenium_driverless.types.by import By

        profile = profiles.Windows()  # or .Android
        options = ChromeOptions()
        # options.add_argument("--headless=new")
        driver = Chrome(profile, options=options, driverless_options=True)

        # get url
        driver.get('https://nowsecure.nl#relax')  # test fingerprint
kaliiiiiiiiii commented 10 months ago

@AlexPaiva This is a known issue. Just use wait_load=False at driver.get() lol:)

AlexPaiva commented 10 months ago

Where can I find a list of known issues? Why is this?

kaliiiiiiiiii commented 10 months ago

@AlexPaiva

Where can I find a list of known issues?

This currently isn't listed anywhere, I might add it tho:)

Why is this?

Not sure, seems like waiting for the page to load isn't always reliable.

AlexPaiva commented 10 months ago

Applying 'wait_load=False' works.