# -*- coding: utf-8 -*-
# @Author: wangkun
# @Time: 2023/9/20
from selenium import webdriver
from common.common import Common  # 导入封装好的 log 记录方法


def start_selenium():
    # 创建 ChromeOptions 对象
    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument('--remote-debugging-port=8888')

    # 启动带有指定选项的 Selenium WebDriver
    driver = webdriver.Chrome(options=chrome_options)

    # 访问抖音首页
    driver.get('https://www.douyin.com/')

    # 获取页面内容
    page_content = driver.page_source

    # 调用 log 记录方法，将页面内容传递给它
    Common.logger('mitm', 'dev').info(page_content)

    # 关闭 WebDriver
    driver.quit()


start_selenium()