Having realized from this discussion that in some places in my application, I really ought to be checking for visible text, not just text, I went ahead and implemented this for vapir. It is, as Alan says, not 100%, as that is probably not possible, but I believe it handles all cases of style.visibility and style.display what with inheritance of css styles and all.
It works for me in both firefox and IE. Currently only a method of Element, not the browser class, but I'll add it to the browser class shortly. Probably not trivial to port back to watir, and not possible on firewatir, but it's there if anybody feels like having a look. http://github.com/vapir/vapir/commit/6b27ab798d18fb56f4ebd05588f905d8f6524598 I'm with Jarmo; using #text isn't bad practice (and is quite necessary) as long as you take into account that whitespace will probably end up being different between browsers. -Ethan On Tue, May 4, 2010 at 22:39, Alan Baird <[email protected]> wrote: > Thanks for the reply Bret. I also want to add my .02 that "visible" > is a bit difficult to nail down. I find the .visible? method to be > pretty good, but not always 100% dependable. For example, in one of > the apps I test, an element is made not visible by using the zindex > value of -999 to place certain elements behind others, thus making > them not visible to the users, but "visible" in terms of the .visible? > method. This is a legitimate way of doing things in HTML, but it > would be very difficult to write .visible? to handle this case. > > As for IE#text, it seems like using this to detect things on a page is > a recipe for bad things to happen. I can't see myself being in favor > of it. > > Alan > _______________________________________________ > Wtr-development mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/wtr-development >
_______________________________________________ Wtr-development mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-development
