Selenium-IDE test can't switch browser windows - firefox

I'm writing a Selenium IDE script to test part of our website that opens a window that takes the user to a third party site that we integrate with. The test clicks a link on our website, that opens a new window on the third party site where we need to tick a checkbox and submit a form, at which point the window closes and we then need to check another page on our own website.
Our problem is that the script breaks at the Selenium selectWindow action, because it says that it cannot find a window with the given name. If we then manually run that line in the IDE, it works!
I have added numerous waits, pauses and other tricks to make sure that the window exists and has the correct title when the SelectWindow action is hit, but we still get the above error.
The script is...
click link=activate
waitForPageToLoad
selectWindow Third party activation site
Are there any tricks to getting this to work?

You dont need that waitForPageToLoad as i'm assuming the host page isn't reloading.
You may want to check out the api ( http://release.seleniumhq.org/selenium-remote-control/0.9.2/doc/java/com/thoughtworks/selenium/Selenium.html#selectWindow(java.lang.String) ) entry for the command. This is the java docs, but it the same for selenium IDE.

Related

Is there a way to automate webpage login and download report?

Is there a way to automate a task a webpage login and download report maybe with power-automate or some other method?
open web page
enter any parameters.
click download button.
save download to local drive.
Thanks
Yes it is possible to automate it using Power Automate Desktop, you can take control of the browser, If the webpage structure remains the same and the login doesn't ask additional captcha except usual login and password fields.
You can configure the automation by
First opening the webpage using Browser Control in PAD(Power Automate Desktop)
Entering the username password can be automatically done with PAD (both should
be defined in the
automation)
Capture the web element using the action to click a button - either to
navigate the page or download something.
Can save the file into local system using PAD by usual browser download or mentioning separate path in the automation.
If you know how to code such as Python. Then Selenium,playwright,Clicknium would be a good choice. Clicknium should be the most simple one, but it can only run in Windows. In include a Recorder to identity the UI element and include APIs for click and set_text.
If you don't want to code, you can use RPA tools, such as power automate and UI path.

Cannot complete download from popup when prompting location with saveAs

I've been working on a browser extension allowing users to generate epub files from any webpage.
To use the extension, a user has to click on a toolbar button which opens a popup. On the latter, after specifying a config, the user clicks on "Generate". Here is my issue though:
When I use the download API directly, and specify saveAs to false (i.e the user is NOT prompted where to save the file), then the download is completed as expected and the file saved in some location.
However, when I do set saveAs to true --- which is what I want in the final version --- then once the user has selected the location under which to save the file, the download fails. My intuition is that as soon as the file location window pops up, the popup looses focus and dies, which makes the download impossible to resume.
Is that the explanation? And is there a way to prevent such a problem? I do not find my use case to be much of a stretch, and do not get why popups associated with browser actions are not allowed to loose focus for file selection.
Another weird thing is that I'm pretty confident this problem only appeared recently in firefox, since when I started developing the extension, I had no issue.
My intuition is that as soon as the file location window pops up, the
popup looses focus and dies, which makes the download impossible to
resume.
That's right...
Browser Action Popup is page and once page is closed, async operations will lose their reference. It is best to pass async operations to the background script.
You can use
runtime.sendMessage()
to pass a message to the background script to run the download.
You can also use the async
runtime.getBackgroundPage() to run a function in the background script but the first option works
easier as you dont need to wait for the async response as in runtime.getBackgroundPage()

Need to re-record part of OpenScript script but don't want to re-record the whole script

We would like to fix a portion of a script in OpenScript by re-recording the part that's not working in lieu of re-recording the whole script. We can't seem to figure out how to do it. Every time we try, Open Script starts with the log in to the testing program. It seems you should be able to start recording at any point. Does anyone know?
create a test script, click on Record, once it launches, in Openscript toolbar pause the recording. Now the recording is stopped, whatever we do will not be recorded .Manually perform the sections which you don't want to record. Then click on resume on the openscript toolbar. Now it will be recorded.
Once done, copy the generated code to the actual script.
[If you are using object library add this as an asset in actual script]
Hope this helps !
Recording from opened browser is supported in Oracle Application testing suite .
1. Open OATS Tool
2. Launch IE
3. navigate to UI where you want to start recording
4. There is Globe icon top (menu Icons), select opened browser
5. Select record
6. Steps will be recorded in Editor
Image:
For more OATS related tips, visit here www.testinghive.com

I need to save a CSV file using selenium and Ruby

I'm struggling with a feature.
I have a scenario where I click a hyperlink to download a CSV. I have the command to open the csv file sorted. Once that hyperlink is pressed, a pop up box shows up in Firefox and I need to select the Save File option then press OK.
I have no idea how to tell selenium to do this. I have a test code to confirm a new webpage has opened (below)
new_window=page.driver.browser.window_handles.last
page.within_window new_window do
current_url.should eql "https://...."
end
This approach doesn't work for the download pop up. I need to move to the pop up and press those two options.
Any help would be appreciated
You are missing one important thing: Once your hyperlink is pressed, Firefox directs the underlying operating system to launch a pop up. In other words, you are no longer dealing with Firefox, and therefore Selenium is completely blind to that modal window. Generally the solution is something like Sikuli, Robot, or some other framework.
Also, have a read through this: http://ardesco.lazerycode.com/index.php/2012/07/how-to-download-files-with-selenium-and-why-you-shouldnt/

Chrome extension: debug content script before packaging

I am developing a Chrome extension. It sets/reads local storage, reads the DOM, and sends an Ajax message. But sometimes it never reaches the server and I don't know where it gets stuck. Reloading the page doesn't work, although the extension works if I load another page in the same tab, and the original page will work if I load it in another tab. I use activeTab permission.
How can I debug this? The Chrome tutorial http://developer.chrome.com/extensions/tut_debugging.html only mentions a popup, which I do not have. (I right-click the icon and "Inspect popup" is not visible.)
I have tried plain old F12/sources, but I don't see my extension there, even when it works.
I am on localhost and the extension is not packaged. I am still working in developer mode.
The extension does not show up in developer tools>Sources>Content scripts, maybe because it isn't packaged. I can see the content script from another regular extension.
To see mine I:
Wrote the following as the first line in my script:
debugger;
Before pressing the extension icon, I bring up the developer tools: F12
Now, when I click the extension icon, my script opens under sources/program. It does not do this if the developer tools is not open.

Resources