How to get control of the current tab in python Selenium?

34 views
Skip to first unread message

Sivanantham M

unread,
Aug 20, 2015, 9:17:52 AM8/20/15
to Selenium Users
Hi All,

I have automated tab shifting operations in the browser (firefox 39.0.3 and mac os x 10.9.2).
From the first page , am able to click the links which will open in new tabs. Then am moving to new opened tabs.
But from the new tab, am unable to click the links which should open in new tab.
 
This is my sample code for get control of the first tab in python Selenium.

home_page = 'http://www.latimes.com/'
driver.get(home_page)
list_links = driver.find_elements_by_tag_name('a')
chain.send_keys(Keys.COMMAND)
chain.click(list_links[0])
chain.perform()
driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + Keys.TAB)
list_links = driver.find_elements_by_tag_name('a')
chain.send_keys(Keys.COMMAND)
chain.click(list_links[0])
chain.perform()
driver.close()




Reply all
Reply to author
Forward
0 new messages