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
WebDriver
inside that function, which will happen once per loop?Or should I instantiate outside the function and pass the
WebDriver
in?Or assign the
WebDriver
to a variable that will be visible from inside the function, without explicitly passing it?