Did you consider or try just adding a brief sleep after the click?

it could be that things were just going too fast for the browser, and
the current 'click on it like mad' solution is just working because
it's working a bit like a small delay to allow the client side code to
make the needed changes to the DOM and render the button visible.

I'd try your code first from IRB, I'll bet that all you need is a
single click there.   Make note of how long it takes from when the
click fires till you see the button..

I'd wager just a one or two second sleep ought to suffice to allow the
thing to render.


On Nov 2, 12:08 pm, Joe Fleck <[email protected]> wrote:
> I have come up with a temporary solution that has worked repeatedly.
>
> Code:
> #Click in the comment field multiple times.
>                 for do_it in 0..12
>
>                   $browser.li
> (:id,'add-new-comment').text_field(:id,new_id).click
>
>                 end
>
>                 #Click in the comment field one last time
>                 $browser.text_field(:id,new_id).click
>
> Joe
>
> 2011/11/2 Joe Fleck <[email protected]>
>
>
>
>
>
>
>
> > Hi,
>
> > I not sure that will work because its getting the buttons to display is
> > the issue I am having.  So if I am using that method would that wait for
> > the buttons to be present and then set the textbox?
>
> > $browser.li(:id,'add-new-comment').text_field(:id,new_id).when_present.set
> > "Comment"
>
> > $browser.input(:id,clicker).click
>
> > 2011/11/2 bis <[email protected]>
>
> >> can you just throw a click at the element and then wait for the element
> >> to be displayed
>
> >> something to the effect of
> >> click the comment field
> >> when_present.set the text for the comment.
>
> >> On Wed, Nov 2, 2011 at 10:42 AM, Joe Fleck <[email protected]> wrote:
>
> >>> Here is the Html:
>
> >>> <div>
> >>>  <input id="comments_presenter_resource_name" class="resource-name" type
> >>> ="hidden" value="SimpleDiscussion" name="
> >>> comments_presenter[resource_name]">
> >>> <input id="comments_presenter_initial_comments_count" class="
> >>> initial-comments-count" type="hidden" value="5" name="
> >>> comments_presenter[initial_comments_count]">
> >>> <input id="comments_presenter_all_comments_count" class="
> >>> all-comments-count" type="hidden" value="1" name="
> >>> comments_presenter[all_comments_count]">
> >>> <input id="comments_presenter_owner_ids" class="owner-ids" type="hidden"
> >>>  name="comments_presenter[owner_ids]">
> >>> <label for="simple_discussion_comments_presenter_17" style="display:
> >>> none;">Add your comment...</label>
> >>> <textarea id="simple_discussion_comments_presenter_17" class="comment-form
> >>> clearfix blurred" rows="75" name="comments_presenter[content]" cols="20"
> >>>  style="height: 17px; overflow: hidden;"></textarea>
> >>> <ul class="buttons" style="display: none;">
> >>> <div style="position: absolute; display: none; font-weight: 400; width:
> >>> 589.5px; font-family: arial,helvetica,clean,sans-serif; line-height:
> >>> 13.35px; font-size: 10.8833px; padding: 6px 2px;">Add your comment...
> >>> &nbsp;</div>
> >>> </div>
>
> >>> On Wed, Nov 2, 2011 at 12:56 PM, Željko Filipin <
> >>> [email protected]> wrote:
>
> >>>> On Wed, Nov 2, 2011 at 5:52 PM, Joe Fl <[email protected]> wrote:
> >>>> > I can't figure out how to get this to work.
>
> >>>> Post link to the page. Or provide HTML that reproduces the problem.
>
> >>>> Željko
> >>>> --
> >>>> watir.com - community manager
> >>>> watir.com/book - author
> >>>> watirpodcast.com - host
>
> >>>> --
> >>>> Before posting, please readhttp://watir.com/support. In short: search
> >>>> before you ask, be nice.
>
> >>>> [email protected]
> >>>>http://groups.google.com/group/watir-general
> >>>> [email protected]
>
> >>>  --
> >>> Before posting, please readhttp://watir.com/support. In short: search
> >>> before you ask, be nice.
>
> >>> [email protected]
> >>>http://groups.google.com/group/watir-general
> >>> [email protected]
>
> >>  --
> >> Before posting, please readhttp://watir.com/support. In short: search
> >> before you ask, be nice.
>
> >> [email protected]
> >>http://groups.google.com/group/watir-general
> >> [email protected]

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to