title: switch between tabs and perform action on individual using Selenium
body: <p>I am trying to extract URLs, open them into a new tab and then perform some actions. My code is-</p>
  
  <pre><code>urls = self.driver.find_elements_by_xpath('//div[@id="maincontent"]/table/tbody/tr/td//a[@href]')
          for url in urls:
  
              try:
                  href = url.get_attribute("href")[28:]
                  print href
                  actions = ActionChains(self.driver)
                  url_1 = self.driver.find_element_by_xpath('//*[@href="'+href+'"]')
                  actions.key_down(Keys.CONTROL).click(url_1).key_up(Keys.CONTROL).perform()
              except Exception, e:
                  print e
  
          actions1 = ActionChains(self.driver)      
          actions1.key_down(Keys.CONTROL).key_down(Keys.TAB).key_up(Keys.TAB).key_up(Keys.CONTROL).perform()
          print "hi"
          show_report = self.driver.find_element_by_xpath('//*[@value="Show Report(s)"]')
          show_report.click()
  </code></pre>
  
  <p>It opens the URLs in new tabs but is not performing action on them. What should I do??</p>