Skip to content

Support New Chrome and undetected-chromedriver Versions - #130

Open
MAbdElRaouf wants to merge 2 commits into
frederikme:masterfrom
MAbdElRaouf:master
Open

Support New Chrome and undetected-chromedriver Versions#130
MAbdElRaouf wants to merge 2 commits into
frederikme:masterfrom
MAbdElRaouf:master

Conversation

@MAbdElRaouf

@MAbdElRaouf MAbdElRaouf commented Jan 15, 2024

Copy link
Copy Markdown

This is to address issues #123 and #126.

  • Bumped selenium (4.16.0), undetected-chromedriver (3.5.4), and webdriver-manager (4.0.1) to support the newest Chrome versions (114 and above).

  • Removed ".v2" from "import undetected_chromedriver.v2" to address new version importing issue.

  • Moved self.started attribute declaration to line 51 so that line 71 doesn't raise "no attribute 'started'" exception.

Tested with Chrome v120 and confirmed everything runs smoothly.

- Removed ".v2" from undetected_chromedriver.v2 to address new version importing issue.

- Moved self.started attribute declaration to line frederikme#51 so that the print in line frederikme#71 doesn't raise "no attribute 'started'".
- Bumped selenium (4.16.0), undetected-chromedriver (3.5.4), and webdriver-manager (4.0.1) to support the newest Chrome versions (114 and above).
@Lembo-Lembo

Copy link
Copy Markdown

Thank you for your update! Unfortunately, I encountered the same problem and the solution provided didn't work for me. I'm new to Python and would appreciate any help.

Here are the details of my setup:

  • Windows x64
  • Google Chrome for Testing 121.0.6167.85 and Google Chrome 121.0.6167.140 (tried both)
  • Chromebrowser 121.0.6167.85
  • Selenium 4.16.0
  • Undetected-chromedriver 3.5.4
  • Webdriver-manager 4.0.1
  • Pillow 10.0.1 (also tried 10.2.0)
  • Deepface 0.0.84
  • Opencv-python 4.9.0.80

C:\TinderBotz-master>py auto_swipe.py
Getting ChromeDriver ...
Traceback (most recent call last):
File "C:\TinderBotz-master\auto_swipe.py", line 14, in
session = Session()
^^^^^^^^^
File "C:\TinderBotz-master\tinderbotz\session.py", line 117, in init
self.browser = uc.Chrome(options=options) # ChromeDriverManager().install(),
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\script\AppData\Local\Programs\Python\Python312\Lib\site-packages\undetected_chromedriver_init_.py", line 421, in init
browser = subprocess.Popen(
^^^^^^^^^^^^^^^^^
File "C:\Users\script\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1026, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\script\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1462, in _execute_child
args = list2cmdline(args)
^^^^^^^^^^^^^^^^^^
File "C:\Users\script\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 608, in list2cmdline
for arg in map(os.fsdecode, seq):
File "", line 830, in fsdecode
TypeError: expected str, bytes or os.PathLike object, not NoneType
/==============\

Tinderbotz
duration: 1
like: 0
dislike: 0
superlike: 0
==============/
Started session: 2024-02-06 22:22:51
Ended session: 2024-02-06 22:22:53
Exception ignored in atexit callback: <function Session.init..cleanup at 0x000002638A23A2A0>
Traceback (most recent call last):
File "C:\TinderBotz-master\tinderbotz\session.py", line 76, in cleanup
self.browser.quit()
^^^^^^^^^^^^

AttributeError: 'Session' object has no attribute 'browser'

C:\TinderBotz-master>

@Extrevarqanze

Copy link
Copy Markdown

I got mine working, in session.py uncomment "self.browser.quit()" by adding a # infront. For me its line 74. All of the changes above from the first guy has to be made. Manually update undetected-chromedriver like this: (pip install --upgrade undetected-chromedriver) without the ( ) brackets. Mine installed version 3.5.5 and then i just had to update chrome to version 126.

@mizitean

mizitean commented Jul 5, 2024

Copy link
Copy Markdown

U MIGHT HAVE DIFFERENT VERSION THAN MINE (3.10), BUT IT SHOULD WORK FOR YOUR VERSION ALSO

  1. Comment in session.py
    # self.browser.quit()

  2. Navigate to the undetected_chromedriver Package Directory:
    cd /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/undetected_chromedriver

  3. Update certifi: Ensure you have the latest version of the certifi package:
    /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -m pip install --upgrade certifi

  4. Edit the patcher.py File
    nano patcher.py

  5. Modify the fetch_release_number Method:

def fetch_release_number(self):
    context = ssl.create_default_context(cafile=certifi.where())
    
    with urlopen(self.url_repo + path, context=context) as conn:
        # existing code to fetch and process the release number
        ...

  1. Save the Changes:
    Press Control + X, then Y, then Enter
  2. Set the Environment Variable in session.py
import os
import certifi
os.environ['SSL_CERT_FILE'] = certifi.where()

@mizitean mizitean mentioned this pull request Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants