I have generated a list of links using selenium,i need to open each link in a separate tab.I have tried body.send_keys(Keys.CONTROL +"t")
and body.send_keys(Keys.COMMAND+"t")
but both didn't work(no errors but nothing happens), after searching for answers i found this link Opening new tabs selenium,however they mostly used java script(which works it opens a new tab) to run it which i can not seem to manipulate such as
driver.execute_script('''window.open("http://bings.com","_blank");''')
however i can not use this in a for loop as follows:
for link in links:
#driver.execute_script("window.open('https://www.yahoo.com')")
driver.execute_script("window.open('%s')")%link
Edit 1: To possible duplicate,the answers given that work are java script codes which works,however i can't use directly in a for loop.
Do i have to open a new random site (using the java script above) then driver.get(link)
to get to my original link
If it matters i use python 2.7 on Linux.