Spaces:
Running
Running
File size: 1,096 Bytes
947c08e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service
from bs4 import BeautifulSoup
import time, threading
class SeleniumScraper:
def __init__(self):
options = Options()
options.add_argument("--headless")
options.add_argument('--no-sandbox')
options.add_argument("--no-quit")
options.add_argument('--disable-extensions')
options.add_argument('--disable-gpu')
options.add_argument('--disable-dev-shm-usage')
options.set_capability('goog:loggingPrefs', {'performance': 'ALL'})
self.__driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
def driver(self):
return self.__driver
|