kaliiiiiiiiii / Selenium-Profiles

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

Pyinstaller executable fails #102

Open AlexPaiva opened 10 months ago

AlexPaiva commented 10 months ago

Describe the bug Using pyinstalelr to turn a script into an .exe makes the driver not open, simply flash a console and not open.

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 A clear and concise description of what you expected to happen.

No error messages

Environment (please complete the following information):

Additional context Initially it gave a missing 'Failed to execute script 'pyi_rth_wind32api' due to unhandled exception: DLL load failed' error but manually adding it as a binary import seems to work.

AlexPaiva commented 10 months ago

Also getting:

2023-09-05 00:10:34 - FATAL ERROR OCCURED: Traceback (most recent call last):
  File "main.py", line 4495, in signup
  File "concurrent\futures\_base.py", line 446, in result
  File "concurrent\futures\_base.py", line 391, in __get_result
  File "concurrent\futures\thread.py", line 58, in run
  File "main.py", line 4199, in gamiCalli
  File "selenium_profiles\profiles\profiles.py", line 12, in Windows
  File "selenium_profiles\profiles\profiles.py", line 6, in return_profile
  File "selenium_profiles\utils\utils.py", line 33, in read_json
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Alex\\AppData\\Local\\Temp\\_MEI105282\\selenium_profiles/profiles/default.json'

I fixed that with manual json imports and making the utils.py and profiles.py code pyinstaller safe but still it just keeps trying to open a node console over and over again without any error

kaliiiiiiiiii commented 10 months ago

@AlexPaiva

  1. Have you checked if the --user-data-dir=C:/some_path/data is valid?
  2. The chrome process starts at https://github.com/kaliiiiiiiiii/Selenium-Driverless/blob/4e478d26ce7090192ff45d835e1efb31bd7bf98c/src/selenium_driverless/webdriver.py#L220 , check what path & arguments are there.
kaliiiiiiiiii commented 10 months ago

@AlexPaiva Does it work with driverless_options=False btw?