我正在使用selenium和python创建一个桌面应用程序..这个应用程序使用selenium从我的网站获取一些数据..它工作正常,没有任何问题,直到我尝试在无头模式下运行chrome ..像这样:
opt = Options()
opt.add_argument("--headless")
cpanel_window = webdriver.Chrome("chromedriver.exe", options=opt)
cpanel_window.get(mywebsite)
Run Code Online (Sandbox Code Playgroud)
它工作正常,但在控制台中一段时间后会出现奇怪的消息..
[1016/142332.539:INFO:CONSOLE(2)]“未捕获的类型错误:无法读取 null 的属性‘left’”,来源:https ://eaalim.examhelper.org/js/lavalamp.js (2)
[1016/142337.343:INFO:CONSOLE(0)]“混合内容:‘ https://eaalim.examhelper.org/cpanel/SendInvoice_1To1.aspx?coursecode=SB22496&back_sid=8969&back_g=All&back_type=s ’处的页面已通过 HTTPS 加载,但请求了不安全的图像“ http://eaalim.examhelper.org/emailtemplates/responsive/images/Icon-responsive.png ”。此内容也应通过 HTTPS 提供。”,来源:https://eaalim.examhelper .org/cpanel/fckeditor/editor/fckeditor.html?InstanceName=ctl00%24ContentPlaceHolder3%24txtemail&Toolbar=默认(0)
[1016/142337.344:INFO:CONSOLE(0)]“混合内容:‘ https://eaalim.examhelper.org/cpanel/SendInvoice_1To1.aspx?coursecode=SB22496&back_sid=8969&back_g=All&back_type=s ’处的页面已通过 HTTPS 加载,但请求了不安全的图像“ http://eaalim.examhelper.org/emailtemplates/responsive/images/logo.png ”。此内容也应通过 HTTPS 提供。”,来源: https: //eaalim.examhelper.org /cpanel/fckeditor/editor/fckeditor.html?InstanceName=ctl00%24ContentPlaceHolder3%24txtemail&Toolbar=默认
应用程序不会停止,但这些消息真的很烦人,因为我在控制台中打印步骤和报告,所以我需要它干净......有什么方法可以避免或隐藏这些消息吗?
python selenium console-application windows-console google-chrome-headless