Commit Graph

113 Commits

Author SHA1 Message Date
Leon cea80717c5
3.5.3
Sorry for not getting earlier at this, my pc had a complete meltdown, m2, and gpu both dead.
picking up a new one this afternoon.

thanks to @jdholtz :

This PR adds support for downloading Chromedriver versions 115+. This is necessary due to the Chromium team's change to Chromedriver's release process (see here).

If the version_main is 114 or older, the Chromedriver will still be downloaded using LATEST_RELEASE_{version}. If the version_main is specified and is 115+, the /latest-versions-per-milestone-with-downloads.json from the new JSON endpoint is used and the version is selected from the corresponding milestone. Last, if the version_main is not specified, the /last-known-good-versions-with-downloads.json endpoint is used to fetch the latest stable version.

In contrast with #1427, this PR uses the new JSON endpoints instead of reverting back to old versions if the LATEST_RELEASE endpoint isn't found (causing version discrepancy errors).

I also added compatibility for installing x86 and arm64 for Mac separately since the platform names changed for the new endpoints. However, I have only tested on Linux and Windows so it would be great if someone could test on Mac (x86 and ARM) It has been tested on Linux, Windows, and Mac with success. The Chromedriver doesn't work on ARM devices when downloading the ARM chromedriver, but it seems to work fine with the x64 version (possibly with Rosetta installed).

This also allows for users to download the Dev and Beta versions (currently 117 and 118) if they specify it using version_main.
2023-08-25 11:57:31 +02:00
unknown 44c5ea7127 3.5.2 - Minor changes and fixes
* removed search paths for Chrome Canary and Chrome Beta from find_chrome_executable()
    since chromedriver is always behind schedule so that means a driver for newer versions than current main could not be found and raises Exception.

* Changed/Fixed wrong binary version caused by patcher.
  Due to multi-threading people and a mistake fromy my side,
  the driver binary currently on disk was always used instead of getting new ones. even if you did not use multithreading.
  so even outdated binaries where kept!
  for multithreading people, it now only keeps the most recent binary and throws away others.
  for normal people, you will get the binary you deserve ;)

* Added more descriptive exceptions when Chrome binary could not be found origin
  no connection could be made to Chrome.

* some stuff i forgot
2023-08-09 19:55:16 +02:00
Leon a0712f87cb
Update __init__.py 2023-08-08 01:01:22 +02:00
Leon 8049384e5a
Update __init__.py 2023-08-08 00:56:49 +02:00
UltrafunkAmsterdam 2b035b4ea1 compatible with selenium 4.10.
also removed service_args, service_creationflags, service_log_path from constructor. added find_elements_recursive helper function
2023-06-12 11:30:57 +02:00
Leon 46b000ae21
Update __init__.py 2023-06-02 23:04:09 +02:00
Leon 874cf2852b
Update __init__.py 2023-06-02 22:44:05 +02:00
Leon 1a1ba7350b
Update __init__.py 2023-06-02 22:42:43 +02:00
Leon 5225881799
Update __init__.py 2023-06-02 22:34:33 +02:00
unknown 6eab5577f1 3.4.7 - added 'more' compatibility for multi thtreads / processing using Chrome(user_multi_procs=True) => ensure you have at least 1 undetected_chromedriver binary in the roaming appdata/undetected_chromedriver before using 2023-05-09 22:18:22 +02:00
unknown e55104be8d added more compatibility for multi thtreads / processing using Chrome(user_multi_procs=True) => ensure you have at least 1 undetected_chromedriver in the roaming appdata/undetected_chromedriver 2023-05-09 22:08:53 +02:00
UltrafunkAmsterdam bf7dcf8b57 3.4.6 2023-02-10 19:29:02 +01:00
UltrafunkAmsterdam 5b636cb768 3.4.5
damn versioning

    **patch to fix headless mode**
    currently headless undetected:
    https://i.imgur.com/CME9ElR.png

    (but still unsupported!)

    -https://stackoverflow.com/a/73840130/7058266
    -https://support.google.com/chrome/a/answer/7679408#hdlssMod110

    thanks @mdmintz for this info
2023-02-08 17:48:52 +01:00
UltrafunkAmsterdam 6e471aaac2 PATCH WEDNESDAY
3.4.5
damn versioning

    **patch to fix headless mode**

    -https://stackoverflow.com/a/73840130/7058266
    -https://support.google.com/chrome/a/answer/7679408#hdlssMod110

    thanks @mdmintz for this info
2023-02-08 17:32:16 +01:00
UltrafunkAmsterdam 96abd37cca PATCH WEDNESDAY
4.4.5

    **patch to fix headless mode**

    -https://stackoverflow.com/a/73840130/7058266
    -https://support.google.com/chrome/a/answer/7679408#hdlssMod110

    thanks @mdmintz for this info
2023-02-08 17:18:28 +01:00
UltrafunkAmsterdam 93adbcf0ef 4.4.5
**patch to fix headless mode**

-https://stackoverflow.com/a/73840130/7058266
-https://support.google.com/chrome/a/answer/7679408#hdlssMod110
thanks @mdmintz for the info
2023-02-08 17:08:44 +01:00
UltrafunkAmsterdam d3fe33fceb 3.4.4 - Fixed 2023-02-08 01:27:50 +01:00
UltrafunkAmsterdam 305803ca95 fix for linux find_elements: SyntaxError: missing ) after argument list 2023-02-05 18:37:28 +01:00
UltrafunkAmsterdam 8baa77352f linux unlink bug fix + version bump 2023-02-05 15:36:31 +01:00
UltrafunkAmsterdam 92192e8c5e fix for #1035 + version bump 2023-02-05 15:15:12 +01:00
UltrafunkAmsterdam c12fcfc0a8 Oh yes, do wanna rockin' with the best
--------------------

https://youtu.be/kMjhrh_XDWk?t=48

--------------------

Big update! be careful as it -potentially- could break your code.

- rewritten the anti-detection mechanism
  instead of removing and renaming variables, we just keep them, but prevent them from being injected in the first place

- rewritten the file naming, to prevent ending up with 1000 of {randomstring}_chromedriver.exe 's
  instead it is just called undetected_chromedriver.exe

- cleanup
  removed compat,v2 files and tests folder
2023-02-04 22:02:46 +01:00
UltrafunkAmsterdam 18d9f47978 3.2.1 - minor fixes 2022-12-29 11:53:24 +01:00
Leon e0997e060f
Update __init__.py 2022-12-29 11:48:09 +01:00
UltrafunkAmsterdam 07abe814a6 more refactoring; fix bug that browser stays opened when script exits 2022-12-26 01:48:01 +01:00
UltrafunkAmsterdam 1e8e83f6ae refactoring 2022-11-29 18:26:11 +01:00
UltrafunkAmsterdam e4d75cbdd0 Merge branch '3.2.0' of http://github.com/ultrafunkamsterdam/undetected-chromedriver into 3.2.0 2022-11-29 18:11:50 +01:00
Leon 6caf8fe3d0
add additional search path for x32 and updated 'port' description 2022-11-29 11:16:45 +01:00
UltrafunkAmsterdam 6adeb2d285 optimized import maze 2022-11-28 23:47:38 +01:00
UltrafunkAmsterdam 25bca31f35 > added WebElement.click_safe() method, in case you get detected
after clicking a link

> added WebElement.children(self, tag=None, recursive=False)
  to easily get/find child nodes

> added example.py where i can point people at
  when asking silly questions
  (no, its actually quite cool, everyone should see it)

> some refactoring
2022-11-28 23:41:38 +01:00
UltrafunkAmsterdam 9db7588a71 3.1.7 2022-11-20 22:07:24 +01:00
UltrafunkAmsterdam 0ce879001f resolve conflicts 2022-11-20 22:05:04 +01:00
UltrafunkAmsterdam 73f554f659 resolve conflicts 2022-11-20 21:44:17 +01:00
Leon 2742ff582d
use_subprocess=True 2022-11-20 21:29:13 +01:00
sebdelsol 2ef9791abb
fix service_creationflags
On Selenium < 4.6.0 it was Service.creationflags
Its now Service.creation_flags
2022-11-06 15:55:34 +01:00
UltrafunkAmsterdam 7cb068d977 Merge remote-tracking branch 'origin/added-window_new()-method-to-open-new-window' into 3.1.6 2022-10-15 19:39:39 +02:00
Leon 40ad1812e2
Update __init__.py 2022-10-15 16:51:47 +02:00
Leon 632bb6b1e5
3.1.6 prep
- use_subprocess  now defaults to True
  since many people do not understand python's  multiprocessing and __name__ == '__main__' 
- added option "no_sandbox" with a default value of True
   since many people seem to run this as root (.......) ,  will run into errors since chrome does not run as root without using --no- 
   sandbox flag.  the downside was that you would get another warning bar about "using unsecure command line flag".  
   uc's no_sandbox option also makes sure this warning get's supressed.
2022-10-15 16:18:13 +02:00
sebdelsol 1c45a39000 service_creationflags 2022-08-30 13:46:41 +02:00
Leon cc44dbcc09
Update __init__.py 2022-07-17 11:18:24 +02:00
sebdelsol 6336874933 fix #704 2022-06-29 12:07:25 +02:00
sebdelsol f5b47dbdd5 forgot truncate 2022-04-04 13:22:28 +02:00
sebdelsol 8084b3f9c4 some headless evasions 2022-04-04 13:20:25 +02:00
sebdelsol 843173827a fix find_chrome_executable() on x86 Windows 2022-03-18 16:11:55 +01:00
sebdelsol 0bf986ee8b fix corrupt prefs when the file already exists 2022-03-18 15:41:53 +01:00
UltrafunkAmsterdam b2e804e977 quickfixes 2022-03-16 23:08:43 +01:00
sebdelsol 4879698118 - fix unlinking driver at exit
- speedup exit process
 - fix creation of driver in multithreaded scenario
 - experimental_option now supports "nested" string  (eg: example: options.add_experimental_option("prefs": {"profile.default_content_setting_values.images": 2 })   )

Author:    sebdelsol <seb.morin@gmail.com>
Author:    UltrafunkAmsterdam
2022-03-16 22:24:05 +01:00
sebdelsol 5c467b31eb fix unlinking at exit and fix driver creation file handling for multithread
Author:    UltrafunkAmsterdam<ultrafunkamsterdam@users.noreply.github.com>
Author:    sebdelsol <seb.morin@gmail.com>
2022-03-16 21:56:17 +01:00
Leon 5c0d2e4cb8
Update __init__.py 2022-03-14 00:37:12 +01:00
UltrafunkAmsterdam 7c25fff16e 3.1.5r2
changed the way how patcher works (for those using multiple sessions/processes).

    when not specifying a executable_path (the default, and recommended!), the filename
    gets randomized to <somehex>_chromedriver[.exe]. this should fix the issue for multiprocessing
    (although Chrome/driver itself has restrictions in this as well, see it using processhacker).
    As i told before, webdriver is a purely io-based operation which only sends and pulls data. multiprocessing/threading isn't going to help much. You'd better use asyncio.)

find_chrome_executable:
    added google-chrome-stable to the list, as some distro's have this name.

advanced_webelements:  bool, optional, default: False
        makes it easier to recognize elements like you know them from html/browser inspection, especially when working in an interactive environment

        default webelement repr:
        <selenium.webdriver.remote.webelement.WebElement (session="85ff0f671512fa535630e71ee951b1f2", element="6357cb55-92c3-4c0f-9416-b174f9c1b8c4")>

        advanced webelement repr
        <WebElement(<a class="mobile-show-inline-block mc-update-infos init-ok" href="#" id="main-cat-switcher-mobile">)>

    note: when retrieving large amounts of elements ( example: find_elements_by_tag("*") ) and **print** them, it does take a little more time for all the repr's to fetch

Chrome() parameters

    driver_executable_path=None
     ( = executable_path )
    if you really need to specify your own chromedriver binary.

    (don't log issues when you are not using the default. the downloading per session happens for a reason. remember this is a detection-focussed fork)

    browser_executable_path=None
        ( = browser binary path )
    to specify your browser in case you use exotic locations instead of the more default install folders

    advanced_elements=False
        if set to True, webelements get a nicer REPR showing. this is very convenient when working
        interactively (like ipython for example).

        <WebElement(<a class="mobile-show-inline-block mc-update-infos init-ok" href="#" id="main-cat-switcher-mobile">)>

        instead of

        <selenium.webdriver.remote.webelement.WebElement (session="85ff0f671512fa535630e71ee951b1f2", element="6357cb55-92c3-4c0f-9416-b174f9c1b8c4")>
2022-03-14 00:05:27 +01:00
UltrafunkAmsterdam b876db7e9a 3.15
changed the way how patcher works (for those using multiple sessions/processes).

    when not specifying a executable_path (the default, and recommended!), the filename
    gets randomized to <somehex>_chromedriver[.exe]. this should fix the issue for multiprocessing
    (although Chrome/driver itself has restrictions in this as well, see it using processhacker).
    As i told before, webdriver is a purely io-based operation which only sends and pulls data. multiprocessing/threading isn't going to help much. You'd better use asyncio.)

find_chrome_executable:
    added google-chrome-stable to the list, as some distro's have this name.

advanced_webelements:  bool, optional, default: False
        makes it easier to recognize elements like you know them from html/browser inspection, especially when working in an interactive environment

        default webelement repr:
        <selenium.webdriver.remote.webelement.WebElement (session="85ff0f671512fa535630e71ee951b1f2", element="6357cb55-92c3-4c0f-9416-b174f9c1b8c4")>

        advanced webelement repr
        <WebElement(<a class="mobile-show-inline-block mc-update-infos init-ok" href="#" id="main-cat-switcher-mobile">)>

    note: when retrieving large amounts of elements ( example: find_elements_by_tag("*") ) and **print** them, it does take a little more time for all the repr's to fetch

Chrome() parameters

    driver_executable_path=None
     ( = executable_path )
    if you really need to specify your own chromedriver binary.

    (don't log issues when you are not using the default. the downloading per session happens for a reason. remember this is a detection-focussed fork)

    browser_executable_path=None
        ( = browser binary path )
    to specify your browser in case you use exotic locations instead of the more default install folders

    advanced_elements=False
        if set to True, webelements get a nicer REPR showing. this is very convenient when working
        interactively (like ipython for example).

        <WebElement(<a class="mobile-show-inline-block mc-update-infos init-ok" href="#" id="main-cat-switcher-mobile">)>

        instead of

        <selenium.webdriver.remote.webelement.WebElement (session="85ff0f671512fa535630e71ee951b1f2", element="6357cb55-92c3-4c0f-9416-b174f9c1b8c4")>
2022-03-13 23:47:57 +01:00