On Fri, Nov 27, 2009 at 2:45 PM, Ethan <[email protected]> wrote:

>
> My proposed API:
>
> 1. Watir::Browser#modal_dialog(options={:timeout => 8}) returns a
> Watir::ModalDialog, which is a newly-created class for this API which
> represents a popup on the browser. this class wraps some underlying object
> and makes things consistent cross-browser. if there is no modal dialog on
> the browser, there are a couple of ways this could go. it could:
> - a) return nil - I think this is simplest, and most preferable.
> - b) return a ModalDialog that is designed to represent a modal dialog
> when one comes into existence, raising an error if it is used in a manner
> that expects a modal dialog to exist when none does. that's how the
> container methods that return elements behave, which personally I'm not
> terribly fond of, but this would be consistent. I'm not sure how consistent
> it needs to be, though, given that modal dialogs are quite different from
> dom elements.
>

If we are looking for a global name, i would use "dialog" or "popup", but
I'm not so sure we wouldn't be better off using different names for the
different types of dialogs.

3. ModalDialog#text (browser.modal_dialog.text)
>

API is fine. I'm unclear on what text would be returned.


> 4. ModalDialog#set_text_field(value) - this would find the first and
> presumably only editable text field on the popup and set its text to the
> given value.
>

Prefer browser.dialog.text_field.set(value)
What happens for authentication dialogs that have two text fields?


> 5. ModalDialog#set_login_credentials(username, password)
>

Prefer browser.authenticate(:username => 'username', :password =>
'password')


> 6. ModalDialog#click_button(button_name)
>

Prefer browser.dialog.button(:name = 'button_name').click


-- 
Bret Pettichord
Lead Developer, Watir, www.watir.com

Blog, www.io.com/~wazmo/blog
Twitter, www.twitter.com/bpettichord
_______________________________________________
Wtr-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to