Firefox Security Warning Dialog Box

13 posts, 0 answers
  1. Marco
    Marco avatar
    1 posts
    Member since:
    Oct 2010

    Posted 25 Oct 2010 Link to this post

    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); 
  2. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 01 Nov 2010 Link to this post

    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
  3. Bipin
    Bipin avatar
    3 posts
    Member since:
    Apr 2012

    Posted 30 Apr 2012 Link to this post

    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
  4. Bipin
    Bipin avatar
    3 posts
    Member since:
    Apr 2012

    Posted 02 May 2012 Link to this post

    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.
    				}
    			}
    		}


  5. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 03 May 2012 Link to this post

    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
  6. Thomas
    Thomas avatar
    6 posts
    Member since:
    Oct 2017

    Posted 04 Oct Link to this post

    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

  7. Nikolay Petrov
    Admin
    Nikolay Petrov avatar
    231 posts

    Posted 10 Oct Link to this post

    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
     
  8. Thomas
    Thomas avatar
    6 posts
    Member since:
    Oct 2017

    Posted 10 Oct in reply to Nikolay Petrov Link to this post

    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.

  9. Nikolay Petrov
    Admin
    Nikolay Petrov avatar
    231 posts

    Posted 13 Oct Link to this post

    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
     
  10. Thomas
    Thomas avatar
    6 posts
    Member since:
    Oct 2017

    Posted 13 Oct Link to this post

    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

  11. Elena Tsvetkova
    Admin
    Elena Tsvetkova avatar
    607 posts

    Posted 2 days and 23 hours ago Link to this post

    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
     
  12. Thomas
    Thomas avatar
    6 posts
    Member since:
    Oct 2017

    Posted 2 days and 23 hours ago in reply to Elena Tsvetkova Link to this post

    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

  13. Elena Tsvetkova
    Admin
    Elena Tsvetkova avatar
    607 posts

    Posted 5 hours ago Link to this post

    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
     
Back to Top