When the browser switches from http to https (or vica versa) I get a 'Security Alert' popup containig the message:'You are about to view pages over a secure connection' or 'you are about to redirect to a connection that is not secure'.
Ranorex seems somehow blocked, when this message appears.
How can I handle this?
How can I handle Serurity Alerts
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
The Internet Explorer (IE) process refuses to load the requested site until you click on the 'Yes' or 'Ok' button of the message box. So you need to automate this click using Ranorex:
Just add these lines of code below the Mouse.ClickWebElement(...) statement that brings the message box up. You may need to alter the code depending on your IE version (use RanorexSpy to inspect the IE security popup).
Regards,
Alex
Ranorex Support Team
Code: Select all
Form popup = Application.FindForm("Security Alert", SearchMatchMode.MatchExact, "#32770");
Control yesButton = popup.FindChildText("&Yes");
Mouse.ClickControl(yesButton);
Regards,
Alex
Ranorex Support Team
the suggested code is not executed
I think there is another problem:
The program does not continue, as soon as the security warning appears.
This means, the first line of your suggested code (Form popup = Application...) is never reached.
My environment is: Win2K and XP (I tried both), DotNet 2.0, Visual Studio 2005, C#.
The program does not continue, as soon as the security warning appears.
This means, the first line of your suggested code (Form popup = Application...) is never reached.
My environment is: Win2K and XP (I tried both), DotNet 2.0, Visual Studio 2005, C#.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
That depends on the method you use to navigate to the unsecure page, whether it blocks the calling thread or not.
If you use Mouse.ClickWebElement(), the code I suggested should work.
Calling WebDocument.Navigate(...), however, blocks the calling thread until the web site is loaded resulting into a deadlock. You can avoid this by calling the WebDocument.Navigate("www.url.com", false) overload. This method overload returns immediately without waiting for the document; ergo, the code clicking onto the security warning will execute.
Regards,
Alex
Ranorex Support Team
If you use Mouse.ClickWebElement(), the code I suggested should work.
Calling WebDocument.Navigate(...), however, blocks the calling thread until the web site is loaded resulting into a deadlock. You can avoid this by calling the WebDocument.Navigate("www.url.com", false) overload. This method overload returns immediately without waiting for the document; ergo, the code clicking onto the security warning will execute.
Regards,
Alex
Ranorex Support Team
I use Mouse.ClickWebElement() in my code, so this seems not the solution.
There is something else I found,which could probably clarify the situation:
I have an identical effect in your example code (WebTesting.cs). The program works perfect until the picture download (line 182, Mouse.ClickWebElement(image, MouseButtonType.RightButton, Alignment.Center).
Here it stays and the next line (Application.Sleep(1000)) is never called.
There is something else I found,which could probably clarify the situation:
I have an identical effect in your example code (WebTesting.cs). The program works perfect until the picture download (line 182, Mouse.ClickWebElement(image, MouseButtonType.RightButton, Alignment.Center).
Here it stays and the next line (Application.Sleep(1000)) is never called.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Do you use the WebDocument.RunWebAutomation() method?
As this method uses the window thread to run an internal web browser, it is not possible to react on popups (like a message box or context menu). Please use the WebDocument.OpenDocument() method instead!
The WebTesting example should run through provided that you haven't uncommented line 42, which calls RunWebAutomation instead of OpenDocument. Did you do that?
Regards,
Alex
Ranorex Support Team
As this method uses the window thread to run an internal web browser, it is not possible to react on popups (like a message box or context menu). Please use the WebDocument.OpenDocument() method instead!
The WebTesting example should run through provided that you haven't uncommented line 42, which calls RunWebAutomation instead of OpenDocument. Did you do that?
Regards,
Alex
Ranorex Support Team
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
We have now found a workaround for the WebDocument.OpenDocument() issue on Windows 2000 that will be included in Ranorex V1.5.1.
For more information see this forum entry.
Alex
Ranorex Support Team
For more information see this forum entry.
Alex
Ranorex Support Team