Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
1.3k views
by Contributing Tester (53 points)

Hello to everyone, I have one simple question: How to open new tab in Firefox using selenium and Python.

I have found the answer, just need to open any web site and 

body = driver.find_element_by_tag_name('body')
body.send_keys(Keys.CONTROL + 't')

So, maybe it's okay but it doesn't work, why? Other way to do it. 

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)
selected by
 
Best answer

Your code works for me. 

Below are possibilities.

If it's OS X, you should use COMMAND + 't'

driver.find_element_by_tag_name('body').send_keys(Keys.COMMAND + 'w')

Also, make sure that no plugin or software is blocking pop up.

Hope that helps!


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...