user3476463
user3476463

Reputation: 4575

Webscrape URL with splinter and Selenium Chrome driver

I'm running Python 3.7.10 with splinter 0.21.0. I'm trying to scrape the URL listed in the code below. When I run the code, I'm getting an error message also shown here. Do you see what the issue might be, and can you suggest how to fix it?

Code:

# Import necessary libraries
from splinter import Browser
from bs4 import BeautifulSoup as soup
import re
import pandas as pd
import matplotlib.pyplot as plt
import time

# Set up Splinter
browser = Browser('chrome')
# Set up base url
base_url = "https://www.facebook.com/marketplace/toronto/search?"
# Set up search parameters
min_price = 1000
max_price = 30000
days_listed = 7
min_mileage = 50000
max_mileage = 200000
min_year = 2000
max_year = 2020
transmission = "automatic"
make = "Honda"
model = "Civic"
#Set up full url
url = f"{base_url}minPrice={min_price}&maxPrice={max_price}&daysSinceListed={days_listed}&maxMileage={max_mileage}&maxYear={max_year}&minMileage={min_mileage}&minYear={min_year}&transmissionType={transmission}&query={make}{model}&exact=false"

Error:

TypeError                                  Traceback (most recent call last)   <ipython-input-2-8360beb65cda> in <module>   1 # Set up Splinter  
----> 2 browser = Browser('chrome')   3 # Set up base url   4 base_url = "https://www.facebook.com/marketplace/toronto/search?"   5 # Set up search parameters
    ~/anaconda3/envs/web_scrape_etl/lib/python3.7/site-packages/splinter/browser.py in Browser(driver_name, retry_count, config, *args, **kwargs)   128         raise DriverNotFoundError(f"Driver for {driver_name} was not found.")   129   
--> 130     return get_driver(driver, retry_count=retry_count, config=config, *args, **kwargs)  
     ~/anaconda3/envs/web_scrape_etl/lib/python3.7/site-packages/splinter/browser.py in get_driver(driver, retry_count, config, *args, **kwargs)   90     for _ in range(retry_count):   91         try:  
---> 92             return driver(config=config, *args, **kwargs)   93         except driver_exceptions as e:   94             err = e
    ~/anaconda3/envs/web_scrape_etl/lib/python3.7/site-packages/splinter/driver/webdriver/chrome.py in __init__(self, options, user_agent, wait_time, fullscreen, incognito, headless, service, config, **kwargs)   68             options=options,   69             service=service,  
---> 70             **kwargs,   71         )   72 
    ~/anaconda3/envs/web_scrape_etl/lib/python3.7/site-packages/splinter/driver/webdriver/setup.py in _setup_chrome(driver_class, config, options, service, **kwargs)   34         rv = driver_class(options=options, **kwargs)   35     else:  
---> 36         rv = driver_class(options=options, service=service, **kwargs)   37    38     return rv  
     TypeError: __init__() got an unexpected keyword argument 'service'

Upvotes: 0

Views: 46

Answers (0)

Related Questions