Commit 90e997a5 authored by Klaus-Uwe Mitterer's avatar Klaus-Uwe Mitterer

Use xvfbwrapper for Firefox

parent 5a6a05ca
......@@ -4,6 +4,7 @@ from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
from xvfbwrapper import Xvfb
import multiprocessing, urllib.request, urllib.error, urllib.parse, time, os
import dbtools, phototools, setuptools
......@@ -126,20 +127,13 @@ def siteHandler(driver, mode = 0, p = 0, db = dbtools.dbHelper()):
if pageHandler(driver, db):
siteHandler(driver, mode, p+1, db)
def mainHandler():
def mainHandler(driver, db):
siteHandler(driver, 0, db=db)
siteHandler(driver, 1, db=db)
if __name__ == "__main__":
db = dbtools.dbHelper()
driver = webdriver.Firefox()
try:
if loginHandler(driver):
p = multiprocessing.Process(target=mainHandler)
p.start()
p.join(1500)
if p.is_alive():
p.terminate()
p.join()
finally:
with Xvfb() as xvfb:
db = dbtools.dbHelper()
driver = webdriver.Firefox()
mainHandler(driver, db)
driver.close()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment