2012-07-23 11 views
5

domanda semplice: come disabilitare completamente la registrazione quando si utilizza selenio dal binding Python, ex codice come segue:Come disattivare la memorizzazione con Selenio con Python vincolante

browser = webdriver.Chrome() 

Ho provato cose come:

options = webdriver.ChromeOptions(); 
options.add_argument('--log-level 3') 
browser = webdriver.Chrome(chrome_options=options) 

o anche:

options = webdriver.ChromeOptions(); 
options.add_argument('--disable-logging') 
browser = webdriver.Chrome(chrome_options=options) 

ma ancora il file dannati 'chromedriver.log' è ancora comparendo su ogni nuova corsa dei test.

risposta

1

Il source code del webdriver di Chrome, mostra l'esistenza di un'opzione chiamata service_log_path.

Quindi, se si vuole sbarazzarsi del file, è possibile impostare questa proprietà su

  • /dev/null se si esegue sotto Linux/Unix;
  • NUL sotto le finestre

Speranza che aiuta

5
driver = webdriver.Chrome(service_log_path='/dev/null') 
Problemi correlati