- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Checking if save dialog is displayed
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.
Does anyone have any ideas or just have had faced with such simulation?
I'm using Selenium with PHPUnit.
- freeskyAmateur
- Posts : 72
Join date : 2011-04-13
Re: Checking if save dialog is displayed
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
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Checking if save dialog is displayed
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.
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.
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Checking if save dialog is displayed
Tue Nov 08, 2011 2:57 pm
OK, I finally solved this problem in other way
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:
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.
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
)
- Code:
Array
(
[0] => selenium_main_app_window
)
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.
- freeskyAmateur
- Posts : 72
Join date : 2011-04-13
Re: Checking if save dialog is displayed
Wed Nov 09, 2011 8:05 am
thank you for your sharing, it's another workaround.
Permissions in this forum:
You cannot reply to topics in this forum