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

前端 未结 6 1797
执笔经年
执笔经年 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:59

    To relocate the GeckoDriver logs you can create a directory within your project space e.g. Log and you can use the argument log_path to store the GeckoDriver logs in a file as follows :

    from selenium import webdriver
    
    driver = webdriver.Firefox(executable_path=r'C:\path\to\geckodriver.exe', log_path='./Log/geckodriver.log')
    driver.get('https://www.google.co.in')
    print("Page Title is : %s" %driver.title)
    driver.quit()
    

提交回复
热议问题