Python|windows下运行selenium提示DevTools listening on ws://127.0.0.1


一直都是在mac下跑python脚本,拿到windows下跑的时候,发现有如下报错:

DevTools listening on ws://127.0.0.1:56778/devtools/browser/1a29f531-5bab-44f4-af9e-fa60641e95df
[2012:6668:0418/094645.182:ERROR:browser_switcher_service.cc(238)] XXX Init()
[2012:6668:0418/094653.354:ERROR:device_event_log_impl.cc(162)] [09:46:53.355] Bluetooth: bluetooth_adapter_winrt.cc:1055 Getting Default Adapter failed.

本来以为没啥影响,可以正常运行测试脚本,但是发现有时候会卡在bluetooth_adapter_winrt这步,要ctrl+c脚本才能正常运行.
从网上找到解决方案:

options.add_experimental_option('excludeSwitches', ['enable-logging'])

发现三个错误同时解决了,记录一下.

更多python|selenium技巧欢迎关注公众号

鉴于,这个问题大家遇到的较多,特建立Python|selenium微信交流群,方便大家交流


相关博文

About rainbird

IOS攻城狮
This entry was posted in Python, windows and tagged , , , , , , . Bookmark the permalink.

One Response to Python|windows下运行selenium提示DevTools listening on ws://127.0.0.1

  1. rainbird says:

    一个简单的示例

    from selenium.webdriver.chrome.options import Options
    from selenium import webdriver

    chrome_options = Options()             # 模拟器设置
    options.add_experimental_option(‘excludeSwitches’, [‘enable-automation’])
    driver = webdriver.Chrome(chrome_options=chrome_options) # 将配置文件加载进webdriver
    driver.get(‘https://baidu.com’)

发表评论