Share
Go down
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Checking if save dialog is displayed

on Mon Nov 07, 2011 7:44 pm
I write a test of exporting some data. When I click button "export", the browser should display a save dialog. Sometimes (with bad input data) there is an error and no data is exported. And my question is: how to check if a save dialog is displayed?
Does anyone have any ideas or just have had faced with such simulation?

I'm using Selenium with PHPUnit.
freesky
Amateur
Amateur
Posts : 72
Join date : 2011-04-13

Re: Checking if save dialog is displayed

on Tue Nov 08, 2011 8:21 am
for example, if the save dialog is displayed, then there is the corresponding html code, such as :
, so you can use 'waitForElementPresent()' to check the element is presented or not
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Re: Checking if save dialog is displayed

on Tue Nov 08, 2011 2:29 pm
freesky, thank you for answer.
But I don't know how I should define dialog in my code? I can't do this by css/xpath in usual way, can I? The save dialog in Firefox hasn't got any attribute.
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Re: Checking if save dialog is displayed

on Tue Nov 08, 2011 2:57 pm
OK, I finally solved this problem in other way Smile

I use getAllWindowNames() to detect if the save dialog is displayed.
When the save dialog is presented, this method return an array with these values:
Code:
Array
(
    [0] => selenium_main_app_window
    [1] => selenium_blank32686
)
And when there is just one main window of application, the returned array has got one value:
Code:
Array
(
    [0] => selenium_main_app_window
)
I noticed that a name of the save dialog has got always selenium_blank and random five digits.

So I simply check a count of all presented windows in my app, 'cause in the other case (error) there is still one main window.
freesky
Amateur
Amateur
Posts : 72
Join date : 2011-04-13

Re: Checking if save dialog is displayed

on Wed Nov 09, 2011 8:05 am
thank you for your sharing, it's another workaround.
Sponsored content

Re: Checking if save dialog is displayed

Back to top
Permissions in this forum:
You cannot reply to topics in this forum