Fletch wrote: > I have been looking for a solution to this problem, and was wondering if > anyone could give me some advice. > I noticed yesterday that WATIR did not pay any attention to the maxLength of > the text_field. > > I have tried using name.set("abc") and name.value = "abc" but both are still > going over the allowed limit. > > The solution that I have come up with (and it is not a good solution) is to > truncate the name. > > nameSize = name.size > maxSize = frame.text_field(:name, 'Name').maxLength > if (vinSize > maxSize) > puts("Bigger than maxLength - #{vinSize} -- #{maxSize}") > name = name[0, maxSize] > end > > This does the job in so far as the maxLength limits are observed, but is > there a better solution to the problem? > > This has been a frequently mentioned problem. I think we should consider it a defect in Watir. Please go ahead and open a Jira ticket on it, and we can go ahead and fix it.
The TextField#set method should limit to max length automatically. Bret _______________________________________________ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general