加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

如何使用python保存使用selenium生成的日志

发布时间:2020-12-16 23:30:46 所属栏目:Python 来源:网络整理
导读:我正在使用网络驱动程序2.20并创建了自动化套装.不像 selenium RC(get_log函数)我无法弄清楚要保存的命令 生成的日志. 我试过了 : FirefoxProfile p = new FirefoxProfile(); p.setPreference("webdriver.log .file","/tmp/firefox_console"); WebDriver dr
我正在使用网络驱动程序2.20并创建了自动化套装.不像
selenium RC(get_log函数)我无法弄清楚要保存的命令
生成的日志.
我试过了 :
FirefoxProfile p = new FirefoxProfile();   
p.setPreference("webdriver.log .file","/tmp/firefox_console"); 
WebDriver driver = new FirefoxDriver(p);

但是找不到python的等价物.
还有http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/sel ……
这也是在java中.另外我看到“导入日志记录”功能不知道
如何使用它将日志保存在文件中.
有什么建议 ?

解决方法

以下内容将为您做同样的事情. python代码没有内部日志.
from selenium import webdriver

p = webdriver.FirefoxProfile()   
p.set_preference("webdriver.log.file","/tmp/firefox_console")
driver = webdriver.Firefox(p)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读