-2

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
FrankF
  • 1
  • 1
  • 2
  • Does this answer your question? [DeprecationWarning: executable\_path has been deprecated selenium python](https://stackoverflow.com/questions/64717302/deprecationwarning-executable-path-has-been-deprecated-selenium-python) – HedgeHog May 12 '22 at 13:15

1 Answers1

1

change the line

driver = webdriver.Chrome('./chromedriver')

to

s=Service(ChromeDriverManager().install())
driver = webdriver.Chrome(service=s)
  • I just tried that, but it then tells me that "Service" is not defined and "ChromeDriverManager" is not defined. Do I need to install additional libraries? – FrankF May 12 '22 at 13:59
  • @FrankF: Please check the mentioned post: https://stackoverflow.com/questions/64717302/deprecationwarning-executable-path-has-been-deprecated-selenium-python – HedgeHog May 12 '22 at 14:22
  • @HedgeHog thanks a lot, I already did. It seems like the main issue is now solved, but the scrape runs into another problem. I have added an image of the error. – FrankF May 13 '22 at 10:52
  • @FrankF: This other issue would be predestined for [asking a new question](https://stackoverflow.com/questions/ask) with exact this focus – HedgeHog May 13 '22 at 10:55