I'm using this code to open Google in IE...
ie = webbrowser.get('C:\\Progra开发者_开发技巧m 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.open_new_tab(url1)
ie.open_new_tab(url2)
ie.open_new_tab(url3)
ie.open_new_tab('http://www.stackoverflow.com')
See http://docs.python.org/library/webbrowser.html#webbrowser.open_new_tab.
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')
精彩评论