I wrote sample code but it is not working. Also observed that there is only 1 window handle for 2 tabs. How to switch to parent tab again?
driver = webdriver.Firefox()
driver.set_page_load_timeout(60)
driver.implicitly_wait(15)
driver.get("https://www.google.co.in")
oldtab = driver.current_window_handle
print oldtab
print driver.title
body = driver.find_element_by_tag_name("body")
print 'new tab opened'
driver.get("http://gmail.com/")
print driver.title
print 'back to old tab'
driver.switch_to_window(oldtab)
print driver.title
for handle in driver.window_handles:
print "Handle = ",handle