Ranorex

How can I handle Serurity Alerts

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexWeb
View previous topic :: View next topic  
Author Message
dareim



Joined: 22 Apr 2008
Posts: 4

PostPosted: Tue Apr 22, 2008 9:28 am    Post subject: How can I handle Serurity Alerts
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?
Back to top
View user's profile Send private message
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 256

PostPosted: Tue Apr 22, 2008 10:51 am    Post subject:
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:
Code: click into code to enlarge
Form popup = Application.FindForm("Security Alert", SearchMatchMode.MatchExact, "#32770");
Control yesButton = popup.FindChildText("&Yes");
Mouse.ClickControl(yesButton);

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
Back to top
View user's profile Send private message Visit poster's website
dareim



Joined: 22 Apr 2008
Posts: 4

PostPosted: Tue Apr 22, 2008 12:03 pm    Post subject: 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#.
Back to top
View user's profile Send private message
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 256

PostPosted: Tue Apr 22, 2008 3:48 pm    Post subject:
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
Back to top
View user's profile Send private message Visit poster's website
dareim



Joined: 22 Apr 2008
Posts: 4

PostPosted: Wed Apr 23, 2008 9:33 am    Post subject:
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.
Back to top
View user's profile Send private message
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 256

PostPosted: Wed Apr 23, 2008 2:25 pm    Post subject:
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
Back to top
View user's profile Send private message Visit poster's website
dareim



Joined: 22 Apr 2008
Posts: 4

PostPosted: Thu Apr 24, 2008 10:15 am    Post subject:
I tried now WebDocument.OpenDocument(..) and it works on xp!

On win2000 I get an error (..failed to initialize properly 0x000007b) as soon as WebDocument.OpenDocument(..) is called.

But actually I can continue this evaluation (on xp) and I make progresses!

Thanks for the help & regards
Back to top
View user's profile Send private message
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 256

PostPosted: Thu Apr 24, 2008 12:27 pm    Post subject:
Good that it works on Windows XP!

Nevertheless, could you please send us a screenshot of the error on Windows 2000 and the full error message so we can investigate that error in detail. Thanks!

Regards,
Alex
Ranorex Support Team
Back to top
View user's profile Send private message Visit poster's website
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 256

PostPosted: Mon Jul 07, 2008 3:58 pm    Post subject:
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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexWeb All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum