我是Python编程的新手,我正在尝试使用Python的webbrowser模块创建一个使用Web浏览器打开URL / IP地址的脚本。
打开Web浏览器的实际操作工作正常,但我收到来自firefox的日志消息,这些消息在我的脚本运行的终端窗口中发送垃圾邮件。虽然它最终不会使脚本无法完成其工作,但是由于错误会使它们超出视图范围,因此很难显示提示。
当我退出衍生的firefox窗口时,似乎会导致这些错误。以下是显示错误的示例:
$("document").ready(function() {
setTimeout(function() {
$("#button_id").trigger('click');
},10);
});
我试图通过使用命令将firefox的实例发送到null而不是终端来缓解这个问题,但这没有帮助:
###!!! [Child][MessageChannel] Error: (msgtype=0x460102,name=PContent::Msg_AsyncMessage) Channel closing: too late to send/recv, messages will be lost
###!!! [Child][MessageChannel] Error: (msgtype=0x2C0048,name=PBrowser::Msg___delete__) Channel closing: too late to send/recv, messages will be lost
有什么想法吗?
谢谢!
我的整个剧本:
os.system("firefox &> /dev/null"); time.sleep(1)
#before calling below in a while loop. opens tabs in the same window that opens from the above command.
webbrowser.open("http://" + urls.pop(0) + ":" + port,new=2)
答案 0 :(得分:0)
我在https://github.com/mozilla/geckodriver/issues/1569处发现以下说法: “再次,正如另一个问题所述,这是从Firefox输出的,因此与geckodriver无关。”与https://github.com/mozilla/geckodriver/issues/1376有关,在使用Java时会出现相同的错误消息。