webdriver error running selenium from tutorial

23 views
Skip to first unread message

C Bacca

unread,
Jun 8, 2024, 4:16:56 AMJun 8
to Selenium Users
1. I'm using Python 3.11 on Windows 10 Pro. I'm fairly new to Python and new to Selenium stuff.
7. I'm using webdriver_manager 4.0.1 and lxml 5.2.2.
2. Selenium seems compatible with Python 3.11.
3. I'm not even using powershell nor do I have a path to it.
4. I'm using a virtual environment.
3. I have Chrome v125.0.6422 installed on my system.
5. I checked my code carefully against what is in the tutorial 3 times and I don't see any typos. See Youtube screen at 5:20.
6. On another message I found I did this: `pip install --upgrade webdriver-manager selenium`
8. I'm doing a tutorial on Youtube which is for Web scraping in a headless server environment from https://www.youtube.com/watch?v=xrYDlx8evR0. The tutorial is from October 2023. Is it outdated already?
9. I get this error whether I have chromedriver.exe in the same folder as my python program or not. I used chromedriver.exe from another tutorial in this same program folder and it worked fine. 

I'm getting this error when trying to use webdrive with selenium.

'powershell' is not recognized as an internal or external command,
operable program or batch file.
'powershell' is not recognized as an internal or external command,
operable program or batch file.
Traceback (most recent call last):
  File "C:\Users\me\OneDrive - coname\Documents\PythonProjects\selentut1\scrape.py", line 15, in <module>
    driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\OneDrive - coname\Documents\PythonProjects\selentut1\.venv\Lib\site-packages\webdriver_manager\chrome.py", line 40, in install
    driver_path = self._get_driver_binary_path(self.driver)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\OneDrive - coname\Documents\PythonProjects\selentut1\.venv\Lib\site-packages\webdriver_manager\core\manager.py", line 40, in _get_driver_binary_path
    file = self._download_manager.download_file(driver.get_driver_download_url(os_type))
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\OneDrive - coname\Documents\PythonProjects\selentut1\.venv\Lib\site-packages\webdriver_manager\drivers\chrome.py", line 32, in get_driver_download_url
    driver_version_to_download = self.get_driver_version_to_download()
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\users\me\OneDrive - coname\Documents\PythonProjects\selentut1\.venv\Lib\site-packages\webdriver_manager\core\driver.py", line 48, in get_driver_version_to_download
    return self.get_latest_release_version()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\users\me\OneDrive - coname\Documents\PythonProjects\selentut1\.venv\Lib\site-packages\webdriver_manager\drivers\chrome.py", line 64, in get_latest_release_version
    determined_browser_version = ".".join(determined_browser_version.split(".")[:3])
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'split'
Error is in this line:
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))

This is in the same folder as I did another selenium tutorial so I would have all the modules installed that I need. I got this error with chromedrive.exe in the same folder as the program, and without chromedriver.exe.

My full program is this:

```
r'''Web scraping in a headless server environment.
From https://www.youtube.com/watch?v=xrYDlx8evR0

Install these: python -m pip install selenium beautifulsoup4 webdriver_manager lxml
Using selenium 4.21.0

'''

import time # For time.sleep(1)
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install())) # ERROR in this line
# ckwidth = 800
# ckheight = 600
# driver.set_window_rect(20, 20, ckwidth, ckheight)
url = 'https://www.neuralnine.com/books'
driver.get(url)

soup = BeautifulSoup(driver.page_source,  'lxml')
headings = soup.find_all('h2', {'class': 'elementor-heading-title'})

for heading in headings:
    print(heading.getText())

time.sleep(10)
driver.quit()
```

Any idea how to fix this? 
Reply all
Reply to author
Forward
0 new messages