Skip to content

Commit

Permalink
Headless Bool
Browse files Browse the repository at this point in the history
  • Loading branch information
mjdaoudi committed Nov 13, 2023
1 parent 22b1c6e commit 23cfca0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def main() -> None:
for region, business_type in product(regions, business_types):
logging.info(f"Scrapping {business_type} in {region}")
try:
Scrapper = WebDriver(CHROME_DRIVER_PATH=os.path.abspath(CHROME_DRIVER_PATH))
Scrapper = WebDriver(
CHROME_DRIVER_PATH=os.path.abspath(CHROME_DRIVER_PATH),
headless=False)
data = Scrapper.scrape(url, f"{business_type} in {region}")
data = list(
map(
Expand Down
5 changes: 3 additions & 2 deletions src/Scrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
class WebDriver:
adresses = []

def __init__(self, CHROME_DRIVER_PATH: str):
def __init__(self, CHROME_DRIVER_PATH: str, headless:bool=True):
self.PATH = CHROME_DRIVER_PATH
self.options = Options()
self.options.add_argument("--headless")
if headless:
self.options.add_argument("--headless")
self.service = Service(executable_path=self.PATH)
self.driver = webdriver.Chrome(service=self.service, options=self.options)

Expand Down

0 comments on commit 23cfca0

Please sign in to comment.