2

I want to open new tab not window.

->When I didn't use Profile Window.Open Script is working fine it opens the link in new tab. But when I use Profile the link is opening in new Window. What to do to open new tab when I'm using profile.

->browser.find_element_by_tag_name('body').send_keys(Keys.COMMAND + "t") is not working. What should I do to open the new tab using keys?

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

profile = webdriver.FirefoxProfile('/path/g8or2923.default')

browser = webdriver.Firefox(profile,executable_path='/path/geckodriver')
browser.get('http://www.google.com')

browser.execute_script("window.open('http://build/')")

browser.find_element_by_tag_name('body').send_keys(Keys.COMMAND+"t")

I'm using Mac OS

Update:

Even tried using actions

actions = ActionChains(browser)
tag = browser.find_element_by_tag_name('html')
actions.key_down(Keys.COMMAND).click(tag).send_keys("t").perform()

Second Update:

Its is not Duplicate of that question.

Im saying window.open open in new window not in a new tab. And Even ActionChains not working

vinieth
  • 1,204
  • 3
  • 16
  • 34

0 Answers0