Electron microscopy
 
Check if a Popup Dialog is a Window or not for Selenium App
- Integrated Circuits -
- An Online Book -
Integrated Circuits                                                                                   http://www.globalsino.com/ICs/        


Chapter/Index: Introduction | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | Appendix

=================================================================================

 

Window handle is a unique identifier that holds the address of all the windows. Therefore, the window handle can be used to check if a popup dialog is a window or not:
         print(driver.window_handles)
         print(driver.current_window_handle)

In some cases, the popup dialog is not a window, but it is just a HTML dialog. Therefore, you can treat it like any other HTML on the page and get its contents. If it is a compound class name, then it contains more than one class. In this case, a CSS selector can be used to find elements with those class names.         

============================================

window_handles and move_to: code:             
         Switch_to function and alert popup window         
      Steps to build the code:   
          Switch_to function and alert popup window         
       Get the following after clicking inspect: 
          Switch_to function and alert popup window
        Righ click the line above:  
          Switch_to function and alert popup window
       Once the line below is performed, then the second window will open:
              driver.find_element(By.XPATH, "//*[@id='Tabbed']/a/button").click()
Output:         
          Switch_to function and alert popup window
          After those lines below, then a window is closed as shown in the image below:
                   if driver.title == "Selenium":
                         driver.close() # Close the particular window
          Switch_to function and alert popup window
         Switch_to function and alert popup window
         
         
         
         
         

 

 

 

 

 

 

 

 

 

 

=================================================================================