Switch from POP up window to original window selenium python -



Switch from POP up window to original window selenium python -

i using below code.at line 0 called website url, line no 1 clicked on image opens popup (2nd ie session) , handle pop using line 3,4,5,6 after in pop ie did work providing name alpha.

now problem have close pop up(2nd ie session ) , focus need switch on first ie i,e line 0,1 ui. how can possible?

0 self.driver.get(url[0]+"abc.com") 1 self.driver.find_element_by_css_selector("input[type=\"image\"]").click() 2 time.sleep(15) 3 parent_h = self.driver.current_window_handle 4 handles = self.driver.window_handles # before pop-up window closes 5 handles.remove(parent_h) 6 self.driver.switch_to_window(handles.pop()) 7 self.driver.find_element_by_id("name").clear() 8 self.driver.find_element_by_id("name").send_keys(alpha)

you have it:

self.driver.close() self.driver.switch_to_window(parent_h)

python-2.7 selenium-webdriver

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -