question

dclaar avatar image
dclaar Suspended asked dclaar Suspended posted

Was there a dialog box?

I have a situation where I might or might not get a dialog box. I'm not sure how to test for that. The capture had the box, so when I re-run and there is no box, it eventually times out, but I don't really want to do it that way. I'm looking for "if dialog box, then..."

iTestGUI Testing(Web-Java Swing-etc)
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
PreetS avatar image
PreetS answered PreetS posted

Are you testing a web application or a java swing application?

8 comments
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

dclaar avatar image dclaar commented ·

sorry, web.

 

0 Likes 0 ·
PreetS avatar image PreetS dclaar commented ·

during replay/execution, we simulate the dialog response before the dialog even pops up. This is due to the very modal nature of the dialog.

The dialogs in the web world are called prompts ('cause the prompt the user to do something. Not to be confused with the CLI prompts). We have an action in the web application called 'listPrompts'.

 

Insert this action where you want to check if a prompt occurred. The response will be empty if there are no prompts, otherwise it will give you a list of all the prompts that have appeared in that session, along with a time-stamp and what the response was (OK or cancel). 

 

You can base your test case logic based on this response. 

0 Likes 0 ·
PreetS avatar image PreetS PreetS commented ·

One thing to keep in mind, that timing is the key here. You may end up executing the 'listPrompts' action before the prompt happens.

There is another action called 'waitForPrompt' which may be useful based on your scenario. 

0 Likes 0 ·
dclaar avatar image dclaar dclaar commented ·

I don't know if it works for every dialog box, but I found that I get: true in the description:

href: javascript:logoutCheck(document.header_save, 'true', 'admin', '1')

 When I describe :link=logout; if there is a save dialog, and false if there is not.

0 Likes 0 ·
PreetS avatar image PreetS dclaar commented ·

seems something specific to your webpgae/javascript.

If that works for you, then you can use that to check for dialog. 

 

By the way if it is a file save dialog, that is an OS specific dialog and not really a web prompt. So my 'listPrompts' will not show the save dialog. 

0 Likes 0 ·
AdamB avatar image AdamB PreetS commented ·

Just curious is it a dialog or a popup web page?

0 Likes 0 ·
dclaar avatar image dclaar AdamB commented ·

This is what it looks like. I think it is a popup, but I guess it is really a javascript popup.

0 Likes 0 ·
confirm_dialog.jpg (61.7 KiB)
PreetS avatar image PreetS dclaar commented ·

Yes this is not the standard browser dialog. 

It's just DHTML. 

 

if that describing the link solution does not work for you, what you should do, is do a describe on this popup dialog or any control on that dialog.

 

If it is not present, then the describe step will fail raising a web-targetnotfound event. In the event handler you can deal with scenario when dialog is not there.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.