【发布时间】:2019-10-16 13:35:46
【问题描述】:
我正在使用 selenium 和 python 创建一个桌面应用程序。 这个应用程序使用 selenium 从我的网站获取一些数据 .. 在我尝试以 headless 模式 运行 chrome 之前,它可以正常工作,没有任何问题 .. 像这样:
opt = Options()
opt.add_argument("--headless")
cpanel_window = webdriver.Chrome("chromedriver.exe", options=opt)
cpanel_window.get(mywebsite)
它工作正常,但在 控制台 有一段时间后出现奇怪的消息..
[1016/142332.539:INFO:CONSOLE(2)] "Uncaught TypeError: Cannot read property 'left' of null",来源: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=Default(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=Default
应用程序不会停止,但这些消息真的很烦人,因为我在控制台中打印步骤和报告,所以我需要它干净.. 有什么办法可以避免或隐藏这些消息?
【问题讨论】:
标签: python selenium console-application google-chrome-headless windows-console