I am using selenium webdriver with python. I am not able to find a way in python by which I can switch the webdriver to a new browser.
My web application have multiple links and buttons
Clicking on any of them leads to a new browser window being opened.
for clicking on buttons and link I have used below code
driver.find_element_by_css_selector("input[type=\"submit\"]").click()
driver.find_element_by_id("btn1").click()
driver.find_element_by_css_selector("#linksPlace > #OIT> a").click()
For selecting subsequent browser windows, I have used below code
for handle in driver.window_handles:
print handle
driver.switch_to_window(handle)
driver.get_window_position(handle)
driver.save_screenshot('E:\Selenium scripts\demo.png')
However I am not able to navigate to that new browser window. I have used below command as well, but things didn't work
driver.switch_to_window(driver.window_handles[-1])
Is there any way by which I can navigate to new browser window? I have seen that there are functions which exist in java and c# to do the same, but struggled so far in python.