selenium Firefox 日志重定向

from selenium import webdriver
from utils.user_agent import GetHeaders
from selenium.webdriver.common.proxy import *


class Firefox(object):

    def usefirefox(self):


        profile = webdriver.FirefoxProfile()
        options = webdriver.FirefoxOptions()
        # 火狐无头模式
        options.add_argument('--headless')
        # 设置日志等级
        options.log.level = "debug"

        # 设置请求头
        user_agent = GetHeaders().firefox()
        profile.set_preference("general.useragent.override", user_agent)
        profile.update_preferences()
        driver = webdriver.Firefox(firefox_profile=profile, firefox_options=options, log_path='/home/ivy/workspace/log')

        return driver

你可能感兴趣的:(python)