我正在使用 web-driver 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)
关于python - 如何用python保存使用selenium生成的日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10752122/