python - 有没有一种方法或函数可以从程序中隐藏selenium的输出?

标签 python python-3.x selenium output

我有一些用Python编写的selenium代码,但问题是selenium总是在程序开始时打印出这个输出

DevTools listening on ws://ip address/devtools/browser/some numbers

由于我的计算机不支持蓝牙,我还得到以下输出:

[10376:9472:1101/171134.942:ERROR:device_event_log_impl.cc(208)] [17:11:34.941] Bluetooth: bluetooth_adapter_winrt.cc:1076 Getting Default Adapter failed.

有没有办法只消除selenium的输出?

最佳答案

我使用在SO here 上找到的以下内容

    options = webdriver.ChromeOptions()
    # disable some annoying debug output to console
    options.add_argument('--log-level=3')
    options.add_experimental_option('excludeSwitches', ['enable-logging'])

    browser = webdriver.Chrome(
        "C://Program Files (x86)//Google//Chrome//Application//chromedriver.exe", options=options)

关于python - 有没有一种方法或函数可以从程序中隐藏selenium的输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64634041/

相关文章:

python - 将 PairedRDD 保存为文本文件

python - 如何显式定义 subqueryload_all 中使用的查询?

python - Canonical Celery 单文件 hello world

java - 如何使用 java/selenium 更改 chrome 的默认下载位置

c# - 如何在 C# 中使用 Selenium 验证是否显示了警报消息?

Python 算法 : Necklace Generation/Circular Permutations

python - Fabric:本地命令用法

python-3.x - 你能解释一下为什么情节在 J 处停止(在索引 10 处)

python - 如何使用 pyplot 绘制 2*2 图像网格?

selenium - 如何选择这个文本区域?