I am iterating a list of links for screen scraping. The pages have JavaScript so I use Selenium. I have a defined a function to get the source for each page.
Should I instantiate the
WebDriverinside that function, which will happen once per loop?Or should I instantiate outside the function and pass the
WebDriverin?Or assign the
WebDriverto a variable that will be visible from inside the function, without explicitly passing it?