Reputation: 2972
I want close browser file window pop-up (when I upload picture to Wordpress).
I tried
driver.close();
driver.findElement(By.id("set-post-thumbnail")).sendKeys(Keys.ESCAPE);
driver.switchTo().alert().dismiss();
but it doesn't work. How to close dialog by Selenium?
Upvotes: 1
Views: 1232
Reputation: 1467
OS Specific dialogs like File Browser can not be controlled by Selenium. It can handle only WebElements or JavaScript/Browser Alerts.
In this specific case, I think it is upload file browser. Workaround may be to pass the absolute path if some text input field is provided along with "Browse" button.
Upvotes: 1