I am using Python. I am trying to open two tabs on chrome, each to a different website. This is my code:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
browser=webdriver.Chrome()
browser.get('http:/reddit.com')
browser.find_element_by_tag_name('body').send_keys(Keys.CONTROL + 't')
time.sleep(3)
browser.get('http://bing.com')
When I run it, the first tab is opened to reddit.com, and then another tab opens to my default webpage, and then bing.com is opened in the original tab. I want the first tab to go to Reddit and the second tab to go to bing, but browser.get('website')
only acts on the first tab.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…