I'm Trying to save a Html Page using Selenium script in java which perform following operations
Now problem is when script click on save as html option it shows a pop-up to save html.
I already set default option for download in Firefox but when i run the script it keep showing me pop-up again and again what i need is:-
Robot
class in java might help you. Check this link as well.
Here is a sample code:
// Create object of Robot class<br>
Robot object=new Robot();
// Press Enter<br>
object.keyPress(KeyEvent.VK_ENTER);
// Release Enter<br>
object.keyRelease(KeyEvent.VK_ENTER);
Window pop ups cant be handled by Selenium.So you can go for follwing options : -
(1) Java Robot Class
(2) Sikuli [Recommended]
(3) AutoIt
These are 3rd party tools used to handle window based pop ups.
Accepting confirmation popups in Selenium can be handled via Alert
object (assuming driver instance is ready):
Alert myAlert = driver.switchTo().alert();
myAlert.accept();
Use autoit download the autoit exe record clicking of that button Use the code and execute it via JS executor
Dont forget to place the code before you are actually executing the step not after executing it
Please switch to windows dialogs first using get window handles eg. Save As
Then, use Robot commands to send Enter key. It will save the file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.