Selenium unit tests in Python — where is my log fi

2019-02-27 10:48发布

So I exported some unit tests from the Selenium IDE to Python. Now I'm trying to debug something, and I've noticed that Selenium uses the logging module. There is one particular line in selenium.webdriver.remote.remote_connection that I would really like to see the output of. It is:

LOGGER.debug('%s %s %s' % (method, url, data))

At the top of the file is another line that reads:

LOGGER = logging.getLogger(__name__)

So where is this log file? I want to look at it.

1条回答
劫难
2楼-- · 2019-02-27 11:42

In your unit test script, place

import logging
logging.basicConfig(filename = log_filename, level = logging.DEBUG)

where log_filename is a path to wherever you'd like the log file written to.

Without the call to logging.basicConfig or some such call to setup a logging handler, the LOGGER.debug command does nothing.

查看更多
登录 后发表回答