import time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from base.BaseCore import BaseCore

baseCore = BaseCore()
log =baseCore.getLogger()


if __name__ == '__main__':
    path = r'F:\spider\115\chromedriver.exe'
    driver = baseCore.buildDriver(path,headless=False)
    # service = Service(r'F:\spider\115\chromedriver.exe')
    # chrome_options = webdriver.ChromeOptions()
    # # chrome_options.add_argument('--headless')
    # # chrome_options.add_argument('--disable-gpu')
    # chrome_options.add_experimental_option(
    #     "excludeSwitches", ["enable-automation"])
    # chrome_options.add_experimental_option('useAutomationExtension', False)
    # chrome_options.add_argument('lang=zh-CN,zh,zh-TW,en-US,en')
    # chrome_options.add_argument('user-agent='+baseCore.getRandomUserAgent())
    #
    # bro = webdriver.Chrome(chrome_options=chrome_options, service=service)
    # with open('stealth.min.js') as f:
    #     js = f.read()
    #
    # bro.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
    #     "source": js
    # })
    gpdm = '9021.T'
    url = f"https://finance.yahoo.com/quote/{gpdm}/press-releases?p={gpdm}"
    driver.get(url)