As a second question, if I have two separate selenium scripts running at the same time, can they interfere with each other, or do they create separate instances?
I'm actually using these to log into my bank. I'm concerned that if I am half way into the login (three separate pages) and then the second script tries to start it from the beginning things could get messy.
As per a question I've included my function:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from bs4 import BeautifulSoup
import time
import json
import traceback
def scrapeBank(bank, return_dict):
try:
remote = 1
debug = 0
if remote == 1:
from pyvirtualdisplay import Display
display = Display(visible=0, size=(800, 600))
display.start()
options = webdriver.ChromeOptions()
options.add_argument('--no-sandbox')
options.add_argument('--disable-extensions')
options.add_argument('--headless')
options.add_argument('--disable-gpu')
driver = webdriver.Chrome(chrome_options=options)
else:
driver = webdriver.Chrome()
[do a bunch of stuff]
print('Bank Scrape completed')
driver.close()
return_dict['transactions'] = transactions
except:
print(traceback.format_exc())
driver.close()