'How to fix Deprecation Warning: executable_path has been deprecated, please pass in a Service object
I am pretty new to coding and Python - The scraper starts off well and works, until at some point (after around 1 minute or so) it stops and hands out this error message.
DeprecationWarning: executable_path has been deprecated, please pass in a Service object
Can anyone tell me how to fix this?
Apparently it refers to line 71 in the code, where the scraper should get item descriptions.
It's based around BeautifulSoup and Selenium:
import time
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import csv
description = productSoup.find('div', id=['desc_div'])
if description:
description = description.find('iframe')['src']
driver = webdriver.Chrome('./chromedriver')
driver.get(description)
time.sleep(5)
description_page = driver.page_source
driver.quit()
descriptionSoup = BeautifulSoup(description_page, 'html.parser')
description = descriptionSoup.find('div', id=['ds_div'])
else:
description = 'NA'```
[1]: https://i.stack.imgur.com/gwppg.png
Solution 1:[1]
change the line
driver = webdriver.Chrome('./chromedriver')
to
s=Service(ChromeDriverManager().install())
driver = webdriver.Chrome(service=s)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |