I am trying to emulate the ctrl+S to save the webpage as html but I can't make it work with Selenium IDE. I tried to look all over SO but there was nothing in particular about this.
I tried the following:
But when I ran the test, the popup did not show to ask me whether I want to save the page.
Am I missing something ?
Thanks in advance.
Maybe you can use something like Autoit to click in "Save" button that you can't reach with Selenium?
Related
]1
There are many examples on what to do with file upload, however I could not find anything in selecting folder. Any ideas how to handle this ?
UPDATE:
I have tried 3 different ways but none worked :
the first is using sendkeys(). This does not work because there is no input field. This dialog opens when you click a button.
The second is using AutoIt, which is used in the uploading files dialog. It causes an error when i use it because I am not uploading a file but just selecting a folder.
the third is robot, where I copy the path I want to the clipboard and try to paste it with robot. It did not work for me.
Update 2:
If you open chrome://extensions/ on chrome browser and tick developer mode you will see a load unpacked extensions buttons. This is the button that when you click you get this windows dialog:
There are different ways by which you can handle File Upload :
Way 1:
WebElement fileInput = driver.findElement(By.name("uploadfile"));
fileInput.sendKeys("C:/path/to/file.jpg");
Way 2:
By using Robot Class API:
driver.findElement(By.By.name("uploadfile")).click();
Robot r = new Robot();
r.keyPress(KeyEvent.VK_KP_DOWN);
r.keyRelease(KeyEvent.VK_KP_DOWN);
r.keyPress(KeyEvent.VK_KP_RIGHT);
r.keyRelease(KeyEvent.VK_KP_RIGHT);
r.keyPress(KeyEvent.VK_ENTER);
r.keyRelease(KeyEvent.VK_ENTER);
Hope it will help you
Selenium support is for Web browser and not for windows dialogs.
the only option for you is to write automation using coded UI or Autoit.
Selenium only works on Web browser, You can use AutoIT but I see you already tried it. In that case I would suggest you to use Sikuli.
I am writing an automated test in Selenium IDE to test one of our applications. Our app throws one of those confirmation dialogs "Are you sure you want to continue."
Click OK or Cancel
Selenium does not support the clicking of these dialog boxes. I have
tried the following SeleniumIDE functions with no success:
chooseOkOnNextConfirmation
chooseOkOnNextConfirmationAndWait
Is there a JavaScript function I can call within SeleniumIDE to do
this, or am I out of luck.
If you are working on IDE the code should be
Command : assertConfirmation
Target : Are you sure you want to continue?
This will help you for sure..
If you are working on WebDriver, then the code should be
driver.switchTo().alert().accept();
You are going to have to use JavascriptExecutor to press the OK or Cancel button while using Selenium. You could try something along the lines of -
((JavascriptExecutor)driver).executeScript("window.confirm = function(msg){return true;};");
That is of course, without seeing any of your code
Im using Selenium IDE for record test for my web app.
Selenium IDE do not recognize the right click in my div. I've customized right click over my div and I wanna test relative functions.
Can anyone help me?
Thanks!
Tommaso
Use 'contextMenu' / 'contextMenuAt' to do a right-click.
But as far as i know, you can not record that yet, so you have to add it manually.
In Selenium IDE, the application has got image as button. The click event for that is not capturing. Is there any alternative Selenium Commands available for that or otherwise, is there any JavaScript user extensions can be added?
Please help.
Thanks
Yes.. the image will act as a button..
Found a solution for that!!
Simply added a JavaScript code which supports clickAt() commands.
To detect button as image you can use one of the below solution
xpath=//img[#src='/images/logo_home.png']
xpath=//img[#alt='Home']
//img[#src='/images/logo_home.png']
I am new in Selenium automation. Could you please explain me how to use this (if one exists) tag? It would be really helpful if you can give example.
The scenario where I am facing problem is: there is a save button, if we click on it a dialog box pops up. I need to enter some text in two text boxes and press save/cancel button on the same dialog. I am using Selenium as a tool and Python as a scripting language. Any help on this will be appreciated.
Thanks in advance!
sel.click("idOfSaveButton")
sel.wait_for_pop_up("popupWindowName", "30000")
sel.select_window("name=popupWindowName")
sel.type("idOfTextBox1", "someText")
sel.type("idOfTextBox2", "someText")
sel.click("idOfCloseButton")
sel.select_window("null")
You can also select the popup window using title=.
You can wait for the confirm box, then switch to it and do whatever you want. I asked familiar question before and the answer is here. Hope it helps.