kaliiiiiiiiii / Selenium-Profiles

undetected Selenium using chromedriver and emulation / device profiles
Other
290 stars 28 forks source link

UNABLE TO LOAD PACKED EXTENSION #112

Closed wealthr closed 1 year ago

wealthr commented 1 year ago

My 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

profile["options"]["extension_paths"] = ['canvas.crx']

options = ChromeOptions()
driver = Chrome(profile, options=options, driverless_options=True)

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

driver.quit()  # Execute on the End!

TRACEBACK:


C:\Users\alima\PycharmProjects\pythonProject\venv\Scripts\python.exe C:\Users\alima\PycharmProjects\pythonProject\TEST.py 
Traceback (most recent call last):
  File "C:\Users\alima\PycharmProjects\pythonProject\TEST.py", line 11, in <module>
    driver = Chrome(profile, options=options, driverless_options=True)
  File "C:\Users\alima\PycharmProjects\pythonProject\venv\lib\site-packages\selenium_profiles\webdriver.py", line 109, in __init__
    options_manager = options_handler(options, profile["options"], duplicate_policy=duplicate_policy,
  File "C:\Users\alima\PycharmProjects\pythonProject\venv\lib\site-packages\selenium_profiles\scripts\profiles.py", line 244, in __init__
    self.apply(options_profile)
  File "C:\Users\alima\PycharmProjects\pythonProject\venv\lib\site-packages\selenium_profiles\scripts\profiles.py", line 263, in apply
    self.add_extensions(profile["extension_paths"], adb=profile["adb"])
  File "C:\Users\alima\PycharmProjects\pythonProject\venv\lib\site-packages\selenium_profiles\scripts\profiles.py", line 529, in add_extensions
    self.Options.add_extension(extension_path)
  File "C:\Users\alima\PycharmProjects\pythonProject\venv\lib\site-packages\selenium_driverless\types\options.py", line 415, in add_extension
    raise NotImplementedError()
NotImplementedError
Exception ignored in: <function Chrome.__del__ at 0x00000274C79AB7F0>
Traceback (most recent call last):
  File "C:\Users\alima\PycharmProjects\pythonProject\venv\lib\site-packages\selenium_driverless\webdriver.py", line 503, in __del__
    if self._started:
  File "C:\Users\alima\PycharmProjects\pythonProject\venv\lib\site-packages\selenium_driverless\sync\webdriver.py", line 31, in __getattribute__
    res = super().__getattribute__(item)
AttributeError: 'Chrome' object has no attribute '_started'

Process finished with exit code 1
kaliiiiiiiiii commented 1 year ago
File "C:\Users\alima\PycharmProjects\pythonProject\venv\lib\site-packages\selenium_driverless\types\options.py", line 415, in add_extension
    raise NotImplementedError()

will be implemented in the next release of driverless

kaliiiiiiiiii commented 1 year ago

@wealthr This is a warning. Please read the error-message fully through before opening an issue.

If you keep opening arbitrary issues, I might have to restrict you from doing so!

wealthr commented 1 year ago

I'm sorry about that, i saw where you shared the method for packed extension, so i tried it and had to raise the issue because it didn't work

kaliiiiiiiiii commented 1 year ago

I'm sorry about that, i saw where you shared the method for packed extension, so i tried it and had to raise the issue because it didn't work

yep, that's because it currently only works with an unpacked extension :)

wealthr commented 11 months ago

i tried running same code above after upgrading my selenium-profile and driverless to the updated version.

i get this error while trying to quit the browser " C:\Users\wealth \PycharmProjects\vent\venv\lib\site-packages\selenium_profiles\webdriver.py:211: RuntimeWarning: coroutine 'Chrome.quit' was never awaited super().quit() RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Process finished with exit code 0 "

kaliiiiiiiiii commented 11 months ago

i tried running same code above after upgrading my selenium-profile and driverless to the updated version.

i get this error while trying to quit the browser " C:\Users\wealth \PycharmProjects\vent\venv\lib\site-packages\selenium_profiles\webdriver.py:211: RuntimeWarning: coroutine 'Chrome.quit' was never awaited super().quit() RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Process finished with exit code 0 "

yep this ideed is an issue with the new driverless & profiles. Atm, there's no fix for that

wealthr commented 11 months ago

okay, is there any other way to close the browser window?, so multiple windows don't have to open on a while loop when an exception occurs

kaliiiiiiiiii commented 11 months ago

okay, is there any other way to close the browser window?, so multiple windows don't have to open on a while loop when an exception occurs

what you can to is just to use the sync version of driverless without profiles

wealthr commented 11 months ago

I need profiles, i will just wait for your update that resolves this

kaliiiiiiiiii commented 11 months ago

I need profiles, i will just wait for your update that resolves this

Yeah unfortanely, solving this one is real hard:/