I have a bunch of links in a list and I want to open each link in a different tab (only one window). I know how to open a new tab in Selenium but for some reason, when I iterate over the list, all links get open in the same tab and I don't know what I am missing. Could anyone explain me what the error is and how I can fix it? I would really appreciate it.
from selenium import webdriver as wd
from selenium.webdriver.common.keys import Keys
url_list = ["https://www.kdnuggets.com/2017/06/text-clustering-unstructured-data.html", "https://github.com/vivekkalyanarangan30/Text-Clustering-API/", "https://machinelearningblogs.com/2017/01/26/text-clustering-get-quick-insights-from-unstructured-data/", "https://machinelearningblogs.com/2017/06/23/text-clustering-get-quick-insights-unstructured-data-2/", "https://machinelearningblogs.com/2017/06/23/text-clustering-get-quick-insights-unstructured-data-2/"]
driver = wd.Firefox(executable_path="/usr/local/bin/geckodriver")
for url in url_list:
body = driver.find_element_by_tag_name("body")
body.send_keys(Keys.COMMAND + "t")
driver.get(url)
Currently using python3.7, Firefox 65.0.1 and Selenium 3.141 on a Mac