Reputation: 1069
I need to build a Python scraper to scrape data from a website where content is only displayed after a user clicks a link bound with a Javascript onclick function, and the page is not reloaded. I've looked into Selenium in order to do this and played around with it a bit, and it seems Selenium opens a new Firefox web browser everytime I instantiate a driver:
>>> driver = webdriver.Firefox()
Is this open browser required, or is there a way to get rid of it? I'm asking because the scraper is potentially part of a web app, and I'm afraid if multiple users start using it, I will have a bunch of browser windows open on my server.
Upvotes: 1
Views: 730
Reputation: 1548
Yes, selenium automates web browsers. You can add this at the bottom of your python code to make sure the browser is closed at the end:
driver.quit()
Upvotes: 0