Python中的硒单元测试

编程入门 行业动态 更新时间:2024-10-24 22:23:31
本文介绍了Python中的硒单元测试-我的日志文件在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

因此,我将一些单元测试从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中的硒单元测试

本文发布于:2023-11-13 23:56:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585646.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单元测试   Python

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!