python - webbrowser not opening new windows -


i got new job working remotely , have start day opening bunch of pages , logging them. love automate process can kind of tedious. leave personal browsing window alone , open new window of pages need. here gist of i'm trying do:

import webbrowser first = true chromepath = 'c:/program files (x86)/google/chrome/application/chrome.exe %s' urls = ("first page", "second page", "third page") url in urls:     if first:         webbrowser.get(chromeppath).open(url)         first = false     else:         webbrowser.open(url, new=2) 

for reason code opening new tabs in current browser, opposite of want doing. going on?

i don't have chrome installed, there seem multiple problems:

  1. according docs, webbrowser.get expects name of browser, not path.
  2. you should save return value of webbrowser.get() , use open remaining urls.

import webbrowser urls = ("first page", "second page", "third page") browser= webbrowser.get('chrome') first= true url in urls:     if first:         browser.open_new(url)         first = false     else:         browser.open_new_tab(url) 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -