title: How to open new tabs in Chrome with different URL's in them using Python and Selenium?
body: <p>Ok so my problem is that I wanted to make a "meme" program that would simply open a bunch of p0rn sites in different tabs with videos that would all start playing and my problem is that I can't figure out how to do so with the tabs, because every single URL in my links.json array will just reload on the same tab so in a span of probably 2 seconds all the pages reload on the same tab and I haven't found any fixes for that on the Internet "using an array, a loop and not closing the tabs" otherwise there are some fixes but the program doesn't make sense if you just have to close the tabs almost immediately so I'm asking does any of you know how to somehow do it using the Selenium thing? I know that there are some other ways, but then the program wouldn't make sense it should work somehow like this:</p>
  
  <p>Open program -> Open Chrome -> for link in links: open new tab with the URL in the .json file(array) -> find element with ("YES I am 18 years or older) -> click on the YES button -> find the play button -> click on it
  and somehow repeat the process for all the URL's or elements in the links.json file</p>
  
  <p>The code that I wrote doesnt have much implemented yet because I just cant figure out how to repeat the loop with the new tabs</p>
  
  <p>The code (so far):</p>
  
  <pre><code>import string
  import os
  import json
  from selenium import webdriver
  import webbrowser
  from selenium.webdriver.common.keys import Keys
  import chromedriver_binary
  import time
  from selenium.webdriver import ActionChains
  
  driver = webdriver.Chrome(executable_path='C:\Program Files\chromedriver80\chromedriver.exe')
  links = json.loads(open("links.json").read())
  
  for link in links:
      driver.get(link) #only opens all the files in one tab :(
      #THIS IS HOW IT SHOULD BE IDEALLY:
      #NEW TAB
      #Open URL in Chrome
      #Find 18y.o. button
      #press YES
      #find play button 
      #press it
      #LOOP AGAIN 
      print("Now accessing: " + link)
  </code></pre>
  
  <p>The .json file(I am not sure if I can add the actuall links so if you want to test it maybe just find your own I used xnnx just sayin')</p>
  
  <pre><code>[ "p0rnLinkNo.0",
    "p0rnLinkNo.1",
    "p0rnLinkNo.2",
    "p0rnLinkNo.3",
    "p0rnLinkNo.4"]
  </code></pre>
  
  <p>I can figure out the buttons but can't figure out the tabs please HELP</p>