How do I detect that SSL is broken on a page, using Selenium - ssl

We have pages where we occasionally see compromised SSL certificate because of third party scripts that load non HTTPS resources (Initially they're fine but they occasionally change). We would like to test those pages for broken SSL every day.
We have tried one approach, attempting to catch a pop-up message that would indicate that we have insecure content on the page. However, we have been unsuccessful in simulating the pop-up message through selenium. It appears that selenium has automatically disabled any popups. While we have identified a Selenium method to disable the suppression of the pop-ups(disable-popup-handler) but we have not been able to successfully see the popup even using this method.
Has anyone found a way to detect broken SSL pages using Selenium?

You need to load a browser profile (with WebDriver) that doesn't have the setting for popup blocker enabled (using the Profile class and giving it the right properties). Then, you will get the Windows popup message concerning the SSL cert. If , for some reason, you cannot control the popup using WebDriver (because its limited to Action control only within the browser content window) then you can use Sikuli API to handle the dialog and export the cert to the "Downloads" dir and then copy the file to expected location for inspection. Unfortunately, if you use Sikuli, that will make your automation script sequential and not work via a RemoteWebDriver grid server and so you wont be able to run parallel tests. Hopfully, WebDriver gives you access to the dialog and so you will be able to run with RemoteWebDriver because that is the best way to go when running scripts, even if you run a browser locally.

Related

File Upload warning Chrome 66 and above to be handled using Selenium Webdriver

Chrome browser allows folder upload (using browse dialog) and recently post version 65 we are seeing a security popup which states that do you trust this site for uploading the files from folder.
This popup is causing the Automation to fail, is there any way to handle it using Selenium? like by using certain capability to bypass it or clicking it?
I already tried Alert accept/dismiss but it doesn't work as it seems that its not an alert. I also tried UIAutomation but it seems that elements are enclosed within the browser without any classname/ID's.
For the time being I have given a workaround of sending Keyboard Tab key and Enter keys.
Is there a proper way to bypass this dialog?
Any help will be appreciated.
Pop-Up Dialog screenshot

How to Force Selenium Webdriver to Use and Keep Cookies?

I'm testing a website which uses cookies for security. Every time a user logs in with a different device or browser they must go through an intensive (email and phone keys) identity verification process. My backup/restore process uses a Firefox addon and works for manual testing.
However when I run Selenium I get triggered to go through the ID process every time. So either Selenium is not using the cookies, or is being given a different browser ID for some reason.
I set a breakpoint to check my cookies are loaded in the Selenium Firefox browser window, but my addon is not available in Selenium Firefox instances.
Selenium documentation is very slim on cookie use:
http://www.seleniumhq.org/docs/03_webdriver.jsp
So any info much appreciated.

Selenium Golang binding without server

There are many selenium webdriver binding package of Golang.
However, I don't want to control browser throught server.
How can I control browser with Golang and selenium without selenium server?
You can try github.com/fedesog/webdriver which says in its documentation:
This is a pure go library and doesn't require a running Selenium driver.
I would characterize the Selenium webdriver as a client rather than a server. Caveat: I have used the Selenium webdriver (Chrome version) from .Net and I am assuming it is similar for Go.
The way Selenium works is that you will launch an instance of it from within code, and it creates a live version of the selected browser (i.e. Chrome) and your program retains control over it. Then you write code to tell the browser to navigate to a page, inspect the response, and interact with the browser by filling out form data, clicking on buttons, etc. You can see what is happening on the browser as the code runs, so it is easy to troubleshoot when the interaction doesn't go as planned.
I have used Selenium to upload tens of thousands of records to a website that has no API and only a graphical user interface. Give it a chance.

Saucelabs tests block on browser allow dialog

My web app uses IndexedDB and I'm testing on SauceLabs. Some months back my tests ran but now they block on a browser dialog that says "http://gbserver3.cs.unc.edu/" wants to: store files on this device", with an Allow button.
This is Win7 and Chrome or Firefox. Likely others too.
How can I dismiss or prevent this dialog?
Update: I have discovered that if I don't ask for quota I don't get the popup and my tests succeed. I'd still like to learn how to get rid of that dialog.
we are using Nightwatch.js in our project and we were facing the same issue.
What actually did the trick was using --unlimited-storage switch when launching the browser.
(List of other command line switches for Chromium can be found here)

How to handle https security warning in IE for selenium rc test on ie

I am getting a warning like this when testing with selenium rc on IE Browser. Is there a command I can use to wait for it and click yes? Changing the Trusted Sites is not an option.
http://windowsxp.mvps.org/images/elevdialog.JPG
What we do is leverage a freely available tool called autoit which can interact with the windows component object model. If you are expecting the dialog you can invoke it with an exec and then proceed with selenium commands. If you want to catch unexpected ones, what we do is execute our selenium commands in a thread and if they time out we then run autoit having it return 0 or 1 depending if it finds a dialog and take things from there.
You are going to have to go into the IE Options and tweak the trusted sites so that it has those 2 sites. Once that has been done then you should be fine.