Answers inline.
On Tue, Dec 8, 2009 at 3:03 PM, Marc Guillemot <
mguil...@yahoo.fr> wrote:
> Hi Simon,
>
>
>> Sorry: not been keeping up to date with my email. *sigh* Here we go:
>>
>> * prompt and confirm will be handled the same way.
>
> any mean to distinguish them?
No. WebDriver isn't a general crawling API: you either know what kind
of alert you're dealing with or it's not meant to be there.
> Again: what about prompt?
As in "window.prompt"? As I said, it's handled as an "Alert", which
will have a "sendKeys" method on it so you can type whatever needs
typing.
>> * Read only operations are forbidden because it involves interacting
>> with the JS thread on the DOM, which is blocked by the alert. Touching
>> it will cause the firefox driver to hang.
>
> this means that an implementation detail of the FirefoxDriver leaks in
> the design of the API :-(
The same is also true of IE and Chrome. It seems like a reasonable
trade-off between ultimate flexibility and actual "implementability".
> Are you sure that you can correctly handle following situtation with the
> Firefox driver in this case: call toggle() and return the right value
> for a checkbox which has some handler that may change the checkbox state
> and that triggers an alert.
Right now, the API doesn't handle this cleanly, so I know that we
can't. *sigh* It should be possible to try and grab the information
before allowing the alert to be displayed and return that to the user.
>> * We plan on silently dismissing the common problematic dialogs:
>> script running too long, bad SSL certs, "your browser has crashed, do
>> you want to send data to X" and so on. Download dialogs are a
>> different thing entirely. I have no idea how we can handle those
>> cleanly, though I suspect we may force all downloads to go to a single
>> location and provide a flag for users to check (an event listener is
>> also an idea, but incongruous with the rest of the API)
>
> this was not my question. I was only talking about dialogs from JS alert
> and JS confirm.
window.alert, window.prompt and window.confirm will all be handled by
the single "Alert" interface, in much the same way as "WebElement"
represents every possible HTML element.
> In which cases is (should) an alert silently be dismissed in the
> FirefoxDriver?
The rule of thumb: an alert will be dismissed if a user doesn't
"switchTo()" it and performs another action. An alert can also be
dismissed by a user. The interface will probably end up looking like:
public interface Alert {
// Get the message of the alert
String getText();
// Fill in a prompt
void sendKeys(CharSequence... keys);
// Click "OK"
void accept();
// Click "cancel"
void dismiss();
}
Cheers,
Simon
> Cheers,
> Marc.
>
>> * There will be a "getText" method to find out what the alert's text was.
>
> you mean when it is automatically dismissed?
>
> Cheers,
> Marc.
>