Selenium WebDriver for C# - Popup Dialog Boxes
问题 Is there any support for working with popup dialogs (specifically file downloads) in c#? 回答1: For a popup windows dialog, you can use the alert to catch: IAlert alert = driver.SwitchTo().Alert(); alert.Accept(); 回答2: No, there isn't - at least not natively. WebDriver only interacts with the webpage. A popup dialog, once instantiated, becomes the domain of the operating system instead of the webpage. You can circumvent the file download/upload dialog by issuing a POST or a GET with the content