1

I monitor a bunch of field logger devices at my job that are connected to water mains. There is no way to open the graphs for all loggers at once.

So, rather than manually opening each logger's graph, I've tried to write a program for opening them automatically. The website is quite, slow so I've set a delay of 10 seconds to allow time to load the graph.

The problem I'm having is, when I'm looking at a graph and the next tab opens, it will set focus to that tab.

Here is the code:

import webbrowser
import pandas as pd
import time 

df = pd.read_excel(r'ids.xlsx', sheet_name=0) 
idlist = df['ID'].tolist()

for i in idlist:
    print(i)
    newstring = "Url"+str(i)
    webbrowser.open(newstring, new=0, autoraise=False)
    time.sleep(10)

Is there a way to open a new tab to open in background without taking the focus from current tab?

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83

1 Answers1

1

Please try python webbrowser.open(url)

javascript window.open(_,url)

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 24 '22 at 19:40