5 language and format
source | link

iI am using selenium webdriver with python, i. I am not able to find a way in python by which iI can switch the webdriver to a new browser.

My web application have multiple links and buttons

Clicking on any of them leads to aa new browser getswindow being opened.

for clicking on buttons and link iI 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, iI 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 iHowever I am not able to navigate to that new browser window. iI have used below command as well, but things did n't worked driver.switch_to_window(driver.window_handles[-1]) isdidn't work

     driver.switch_to_window(driver.window_handles[-1])

Is there any way by which iI can navigate to new browser window? iI have seen that there are functions which exist in java and c# to do the same, but strugglesstruggled so far in python.

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 gets opened.

for clicking on buttons and link i 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, 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. i have used below command as well, but things did n't worked driver.switch_to_window(driver.window_handles[-1]) is there any way by which i can navigate to new browser? i have seen that there are functions which exist in java and c# to do the same, but struggles so far in python.

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.

    Post Closed as "duplicate" by Niels van Reijmersdal, Kate Paulk, Yamikuronue, testerab of
4 edited title
| link

selenium how can i switch to the new instance of browser in python web driverselenium webdriver

3 added 217 characters in body
source | link

tryingi am using selenium webdriver with python, i am not able to automatefind a web application where multiple components existway in main portalpython by which i can switch the webdriver to a new browser. after clicking

My web application have multiple links and buttons

Clicking on any component on the portal,of them leads to a new browser gets opened. i want to select that browser and perform some click  

for clicking on main portalbuttons and link i 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, 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')

still ihowever i am not able to navigate to that new browser. i have used below command as well, but things did n't worked    driver.switch_to_window(driver.window_handles[-1]) is there any way by which i can navigate to new browser? i have seen that there are functions which exist in java and c# to do the same, but struggles so far in python.

trying to automate a web application where multiple components exist in main portal. after clicking on any component on the portal, a new browser gets opened. i want to select that browser and perform some click

for clicking on main portal i 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, 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')

still i am not able to navigate to that new browser. i have used below command as well, but things did n't worked  driver.switch_to_window(driver.window_handles[-1])

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 gets opened.  

for clicking on buttons and link i 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, 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. i have used below command as well, but things did n't worked  driver.switch_to_window(driver.window_handles[-1]) is there any way by which i can navigate to new browser? i have seen that there are functions which exist in java and c# to do the same, but struggles so far in python.

2 added 38 characters in body
source | link
1
source | link