【问题标题】:How can I open URLs in an existing browser window with the webbrowser module?如何使用 webbrowser 模块在现有浏览器窗口中打开 URL?
【发布时间】:2011-11-30 20:33:47
【问题描述】:

我正在使用webbrowser Python module 在 Internet Explorer 中打开图像。具体来说,我使用的是webbrowser.open('C:...', new=0) 命令。

然而,即使我说new=0 我的网址总是在新的浏览器窗口中打开。

我该怎么做才能在已经打开的浏览器窗口中打开我的链接?

感谢您的帮助。

【问题讨论】:

  • Internet Explorer 的哪个版本?你试过webbrowser.open_new_tab()吗?问题可能是浏览器通过默认的“来自外部源的链接”方法打开链接。

标签: python browser webbrowser-control


【解决方案1】:

试试 open_new_tab。

webbrowser.open_new_tab(url)

Open url in a new page (“tab”) of the default browser, if possible, otherwise equivalent to open_new().

来自文档:http://docs.python.org/library/webbrowser.html

【讨论】:

  • 不起作用。我用的是ie8。所有命令都不起作用(例如 new=0,1,2)都被忽略
猜你喜欢
  • 2018-04-17
  • 1970-01-01
  • 1970-01-01
  • 2021-09-19
  • 2014-05-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多