简体   繁体   English

Python-在Internet Explorer中打开多重选项卡

[英]Python - Opening Multible Tabs in Internet Explorer

I'm using this code to open Google in IE... 我正在使用此代码在IE中打开Goog​​le ...

ie = webbrowser.get('C:\\Program Files\\Internet Explorer\\IEXPLORE.exe')

ie.open('http://google.com")

I need to open multiple tabs though, so how could I do that? 但是,我需要打开多个标签,该怎么办?

I haven't tested with IE, but this is the way it's supposed to work: 我尚未使用IE进行过测试,但这是它应该起作用的方式:

ie.open_new_tab(url1)
ie.open_new_tab(url2)
ie.open_new_tab(url3)

I think this might help you! 我认为这可能对您有帮助! You just need to wait the main windows load to open a new tab. 您只需要等待主窗口加载即可打开新标签页。

import win32com.client, time import webbrowser webbrowser.open_new_tab('http://www.yahoo.com') time.sleep(2) #wait 2 sec. webbrowser.open_new_tab('http://www.google.com.br')

ie.open_new_tab('http://www.stackoverflow.com')

请参阅http://docs.python.org/library/webbrowser.html#webbrowser.open_new_tab

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM