因此,我将一些单元测试从Selenium IDE导出到了Python.现在,我正在尝试调试某些内容,并且我注意到Selenium使用logging模块.我真的很想在selenium.webdriver.remote.remote_connection中有一行特定的输出.它是:
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.
推荐答案在单元测试脚本中,放置
In your unit test script, place
import logging logging.basicConfig(filename = log_filename, level = logging.DEBUG)其中log_filename是您想要将日志文件写入的位置的路径.
where log_filename is a path to wherever you'd like the log file written to.
如果没有调用logging.basicConfig或进行类似的调用来设置日志记录处理程序,则LOGGER.debug命令将不执行任何操作.
Without the call to logging.basicConfig or some such call to setup a logging handler, the LOGGER.debug command does nothing.
更多推荐
Python中的硒单元测试
发布评论