This is a migrated thread and some comments may be shown as answers.

Firefox Security Warning Dialog Box

12 Answers 119 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Marco
Top achievements
Rank 1
Marco asked on 26 Oct 2010, 01:27 AM

I'm currently running into a problem with an automated Firefox test where it hits an warning and a dialog box pops up. I've attached a screenshot of the dialog box. I want to have WebAii click "Continue" and move on through the test. I have the following code and it catches the dialog box but doesn't press "Continue". I've also tried to circumvent the issue by disabling all warnings that could relate to this. I have also tried changing the buttonID Parameter from 0-2 and it seemed to have no effect. Any insight would be greatly appreciated.

GenericDialog securityWarningDialog = new GenericDialog(scenario.Manager.ActiveBrowser, "Security Warning", false, 0);   
  
scenario.Manager.DialogMonitor.AddDialog(securityWarningDialog);
  
scenario.Manager.DialogMonitor.Start(); 
  
browser.Actions.Click(loginButton); 
  
scenario.Manager.DialogMonitor.Stop(); 
  
Assert.IsTrue(scenario.Manager.Browsers.Count == 1); 

12 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 01 Nov 2010, 11:58 PM
Hello Marco,

That dialog isn't a standard Windows dialog that can be handled via the GenericDialog handler. It's one of Firefox's special Mozilla windows that must be handled with a custom dialog handler as documented here.

Best wishes,
Cody
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Bipin
Top achievements
Rank 1
answered on 30 Apr 2012, 09:57 PM
I am having the same issue with Firefox Security Warning dialog.

In addition, I want to check if the warning dialog box actually appears. If the security warning dialog does not appear, I want to continue without any error.

The link provided refering to documentation does not work.

Can you provide the solution or working link to the solutions?

Thank you
0
Bipin
Top achievements
Rank 1
answered on 02 May 2012, 08:48 PM
Marco,

Were you able to resolve this issue? I am having the same issue.

Currently, I put the workaround by hardcoding the continue button x and y position in the custom dialog class. It works.

I would really like to get the real solution from Telerik.

Example

/// <summary>
		/// This is called by the DialogMonitor whenever IsDialogActive returns true.
		/// </summary>
		public override void Handle()
		{
			// If you are sharing this implementation with other
			// developers, this allows them to override this method
			// by setting the handler delegate. So if the
			// delegate is null, perform the built in handling logic
			// otherwise call the custom handling logic.
			if (this.HandlerDelegate != null)
			{
				this.HandlerDelegate(this);
			}
			else
			{
				try
				{
					// TODO: this is returning null. Find a way to get the continue and cancel button.
					//Window yesButton = WindowManager.FindWindowRecursively(this.Window.Handle, "&Continue", false, 0);
					//Window noButton = WindowManager.FindWindowRecursively(this.Window.Handle, "&Cancel", false, 0);
 
					// Workaround: Dialog position within parent window + Button position within dialog window
					int continueButtonX = this.Window.Rectangle.X + 256;
					int continueButtonY = this.Window.Rectangle.Y + 142;
					int cancelButtonX = this.Window.Rectangle.X + 342;
					int cancelButtonY = this.Window.Rectangle.Y + 142;
 
					this.Window.SetActive();
					this.Window.SetFocus();
 
					switch (this.DismissButton)
					{
						case DialogButton.CLOSE:
							this.Window.Close();
							break;
 
						case DialogButton.YES:
							this.desktopObject.Mouse.Click(MouseClickType.LeftClick, continueButtonX, continueButtonY);
							break;
 
						case DialogButton.NO:
							this.desktopObject.Mouse.Click(MouseClickType.LeftClick, cancelButtonX, cancelButtonY);
							break;
					}
 
					// Make sure the dialog is knocked down.
					this.Window.WaitForVisibility(false, 500);
				}
				catch
				{
					// Do any custom handling and return error.
				}
			}
		}


0
Anthony
Telerik team
answered on 03 May 2012, 06:37 PM
Hello Bipin,

The custom Firefox dialog page has been moved to here.

Greetings,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Thomas
Top achievements
Rank 1
answered on 04 Oct 2017, 08:50 PM

Hello Anthony,

I have the same problem with the exact same dialog box as the original poster.  The link you provided no longer works.  The closest information I can find on the website is about 'Firefox Dialogs' but only goes into detail on closing the dialog box, not selecting one of the buttons.  I either would like to press, 'Continue', or 'Cancel'.  

Link: http://docs.telerik.com/teststudio/testing-framework/write-tests-in-code/advanced-topics-wtc/html-popups-and-dialogs-wtc/firefox-dialogs

 

Please advise.  Thanks,

Tom

0
Nikolay Petrov
Telerik team
answered on 10 Oct 2017, 02:49 PM
Hi Tom,

The documentation you mentioned does not cover the case you need to automate indeed. I would suggest to try to handle this dialog with a generic one that is created with proposed constructor options or other once if suits better to your case:
GenericDialog SecurityWarningDialog = new GenericDialog(ActiveBrowser, "Security Warning"true"Continue", "...Some text content of the dialog...");
You have to adjust the last string to include some of the actual dialog text content.

To be able to help further would you provide sample application that generates such dialog?

Best Regards,
Nikolay Petrov
Progress Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Thomas
Top achievements
Rank 1
answered on 10 Oct 2017, 06:25 PM

Hello Nikolay,

Thank you for the response.  I tried the GenericDialog with a few different set of parameters without any luck:

 

GenericDialog SecurityWarningDialog = new GenericDialog(ActiveBrowser, "Security Warning", true, "Continue", "The information you have entered");
GenericDialog SecurityWarningDialog = new GenericDialog(ActiveBrowser, "Security Warning", true, "Continue", "Are you sure you want to send"); 

 

 

(I also inserted a wait for 3 seconds prior to the alert just in case and retried those examples).  Unfortunately, the application we have is not open to the public for me to provide you with the exact example to reproduce on your side.  For now, I can only provide a screen capture of the alert I have.

0
Nikolay Petrov
Telerik team
answered on 13 Oct 2017, 02:54 PM
Hello Tom,

Thank you for trying the proposed solution.

I would propose to try as a workaround of this problem an approach similar to the one proposed in this article. Using key press combination to handle the security warning dialog.

Best Regards,
Nikolay Petrov
Progress Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Thomas
Top achievements
Rank 1
answered on 13 Oct 2017, 04:03 PM

Hello Nikolay,

I have implemented a workaround for this problem using conceptually the same strategy the article you have provided for me.  I have put a hard coded wait before interacting with the dialog since I cannot formally detect when I need to use key presses.  Is there any strategy you recommend to make my testing synchronization optimally robust?

 

Thanks,

Tom

0
Elena
Telerik team
answered on 17 Oct 2017, 01:51 PM
Hi Tom,

Thank you for your cooperation to implement the shared solution. 

Since that approach helped you to handle the dialog I suspect that the page which prompts with it actually keeps loading until the dialog is not being handled. The page does not return ReadyState and this is what prevents the provided by Test Studio standard dialog handling approach. 

Though using that workaround with a coded approach to send so called 'blind' mouse and/or keyboard actions could not be synchronized in other way except including a hard coded execution delay. Test Studio interacts with the elements on page loaded in the DOM tree and since for that current scenario there are no such elements (the page is not loaded) you could not rely on wait on elements actions. 

I hope this will be helpful to you. Thank you for your understanding in advance! 

Regards,
Elena Tsvetkova
Progress Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Thomas
Top achievements
Rank 1
answered on 17 Oct 2017, 01:56 PM

Hello Elena,

Your explanation is on point and now I understand why this issue.  Thank you for the response and helping me comprehend this scenario better.

 

Regards,

Tom

0
Elena
Telerik team
answered on 20 Oct 2017, 07:37 AM
Hi Tom,

Thank you for the feedback. I am glad to know my previous reply was helpful to you.

Please do not hesitate to contact us again in case of any further queries. Thanks! 

Regards,
Elena Tsvetkova
Progress Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
Marco
Top achievements
Rank 1
Answers by
Cody
Telerik team
Bipin
Top achievements
Rank 1
Anthony
Telerik team
Thomas
Top achievements
Rank 1
Nikolay Petrov
Telerik team
Elena
Telerik team
Share this question
or