Bret Pettichord wrote:
> On 9/26/06, *Sun* <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>     Regarding documentation, please see:
>     http://en.wikipedia.org/wiki/Watir
>
>
> Thank you for taking the time to do this. I do have a comment that i 
> hope you won't take personally.
>
> I find code like this to be rather embarrassing:
>
> # To handle general popups, use WinClicker.
> ie.button(:name, "btnG").click_no_wait   # ensure popup won't block Watir
>
>
> hwnd = ie.enabled_popup(5)               # get a handle if one exists
> if (hwnd)                                # yes there is a popup
>   w = WinClicker.new
>   w.makeWindowActive(hwnd)
>   w.clickWindowsButton_hwnd
>  (hwnd, "Yes") # click the "Yes" button
> end
> I keep meaning to write a simpler way of doing this kind of thing, but 
> then never really have the time to follow through. In my opinion, The 
> code should actually look like this:
>
> ie.button(:name, "btnG").click_no_wait   # ensure popup won't block Watir
> ie.dialog.button('OK').click
>   
I disagree that the code *should* look like that.  That is nice code if 
you *know* that a dialog has appeared.  The problem is that after 
performing a click_no_wait you don't know what kind of popup may appear 
(or even IF one will appear).  It could be an IE security warning, or a 
Javascript dialog, or a modal dialog.  I have sites that I use Watir for 
that DO just that type of thing.  After clicking a button I may get a 
Javascript popup with an error warning, or I may get a modal dialog with 
additional input fields.

The reason I wrote enabled_popup is because Windows uses an 
"enabled_popup" call to give you a window handle to *whichever* popup 
window is active.  I often use it in combination with 
Watir::until_with_timeout to detect when either a popup has appeared OR 
the browser has finished loading (with no popup).  If a popup is 
detected then you can do various tests to determine which type of popup 
is present and handle it as needed.

Also, since we get error messages in Javascript popups we also need to 
be able to access any text in them, which WinClicker also provides.
> I did begin implementing an interface like this in watir once (see 
> watir/dialog.rb and unittests/dialog_test.rb), but didn't finish. It 
> used the Autoit library, which i also now think is not the best approach.
>
> I would love to see someone finish this work. Clearly, this is a 
> common problem for Watir users, but my view is that the problem is not 
> a lack of documentation, but rather a hard-to-user interface. I would 
> love to get this cleaned up for the full release of 1.5.
>
> Bret
Perhaps you'd find more people willing to finish the work if their work 
wasn't partially merged without notice.  Or perhaps people would be more 
willing to contribute if their functioning code, used by other Watir 
users, wasn't removed from Watir without notice.  Maybe folks would be 
happy to contribute their hard work if they weren't summarily removed 
from the commit group after they admitted to breaking a method used by 
some users (searching for :id by regexp) but for which there were NO 
unit tests AND THEN FIXING THAT BUG AND ADDING IN THE MISSING UNIT 
TESTS.  Referring to their code as "unreliable" with no evidence of any 
problem with that code or any failures of any unit tests, especially 
when the problem someone was having was not related to that code also 
shows a certain pre-disposition towards that code.

I've seen another list member censored by having all of HIS posts 
moderated after he made some statements disagreeing with some of the 
decisions being made by the Watir developers.

I believe it's better to have code that solves people's problems, and in 
making that code available to them as soon as possible rather than 
waiting to release a new version until the code is "finished" or 
"perfect".  This is because almost NO code is ever "finished" or 
"perfect".  Different people have different uses for Watir, and need 
different functionality.  Just because a particular method isn't useful 
for one user doesn't mean it isn't required by other users.  The best 
way for code to be tested by the community and peer reviewed is to have 
it USED by that community in development builds.  I'm not saying my 
contributions have all been perfect or the best they could be, but my 
code is working in production systems, and working well.  I think I've 
also shown a willingness to promptly fix any problems that are shown.

Sorry to vent, but I'm the author of the enabled_popup() method (which 
has been removed from watir.rb) and the one that helped Sun solve his 
problem when he presented it to the list.  Statements welcoming 
contributions aren't entirely consistent with the treatment those 
contributions receive.

I fully expect comments explaining that my code was inappropriate or 
didn't work, but I'll let my code and methods stand for themselves and I 
welcome peer review, comments and improvements to my contributions.

David Schmidt
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to