0

Though this is probably not the intended use for Selenium, I want to open up a few (typically 2-5) tabs at the same time after I have logged in.

Here is what I've tried:

for estimate in estimates:
        browser.find_element_by_tag_name('body').send_keys(Keys.CONTROL + 't')
        browser.get('http://www.example.com/' + dic['Id'])

The problems I have with this method is that:

  1. It uses unofficial means to open new tabs and
  2. Requires each webpage to fully load before moving on to the next.

I was wondering if there was a more efficient, elegant way to accomplish this.

Edit: To clarify, I do not need to be able to manage the tabs. I just wish to open up a few tabs for the convenience of the user after I am done running the program.

Vincent Wu
  • 121
  • 3
  • 11
  • Try searching around a bit. Other solutions might exist on SO already? http://stackoverflow.com/questions/18150593/selenium-multiple-tabs-at-once – daniel.caspers Jun 09 '16 at 01:31
  • @BlazeBiker I probably should have been more clear in my question if it was so easily mistaken. I spent the better part of an hour searching around SO and couldn't find anything. My question is regarding opening a few tabs at the same time, whereas the link that you've posted is more towards managing pre-existing tabs concurrently. I've updated the question to clarify this. – Vincent Wu Jun 09 '16 at 03:13

1 Answers1

0

I was unable to find a better solution, so I have resorted to a method that is inadvisable under normal circumstances:

browser.set_page_load_timeout(0)
for estimate in estimates:
    browser.find_element_by_tag_name('body').send_keys(Keys.CONTROL + 't')
    try:
        browser.get('https://www.example.com)
    except:
        pass

By setting the page load timeout to 0 seconds, you can load pages limited to only the natural constraints of your driver.

Vincent Wu
  • 121
  • 3
  • 11