How do I relocate/disable GeckoDriver's log file in selenium, python 3?

前端 未结 6 1845
执笔经年
执笔经年 2021-01-02 06:14

Ahoy, how do I disable GeckoDriver\'s log file in selenium, python 3?

If that\'s not possible, how do I relocate it to Temp files?

6条回答
  •  忘掉有多难
    2021-01-02 06:55

    I added in a separate library (.py file)

    which looks like this (for test purposes):

    import time
    import random
    
    from selenium import webdriver
    driver = webdriver.Firefox(executable_path=r'C:\Users\specimen\RobotFrameWorkExperienced\RobotLearn\Log\geckodriver.exe', service_log_path='./Log/geckodriver.log')
    
    class CustomLib:
        ROBOT_LIBRARY_SCOPE = 'RobotLearn'
    
        num = random.randint(1, 18)
    
        if num % 2 == 0:
            def get_current_time_as_string(self):
                localtime = time.localtime()
                formatted_time = time.strftime("%Y%m%d%H%M%S", localtime)
                return formatted_time
        else:
            def get_current_time_as_string(self):
                localtime = time.localtime()
                formatted_time = time.strftime("%S%m%d%H%M%Y", localtime)
                return formatted_time
    

    But now it opens up 2 instances, 1 runs correct, 1 stays open and does nothing furthermore.

    help help.

提交回复
热议问题