Oh man, that FAQ is kind of dated, and more confusing than I remember it being. I should tidy a couple things there.
The specific use case detailed in "Why are my tests taking so long?" section of that FAQ is going to be rare, and very unlikely to apply to you. So you should just ignore that one. :) when_present - Waits for element to be present, now deprecated wait_until(&:present?) - Waits for element to be present; this is recommended usage. wait_until_present - this one is slightly trickier, and hopefully the need for it goes away in a future release. Essentially this method is needed in a very rare use case: the element is located, then goes away, and you want to wait for it to come back. http://watir.com/guides/waiting/#wait-until-present-and-wait-while-present relaxed_locate = true is the default. Relaxed means that it will automatically wait for elements to be present if they are not. relaxed_locate = false is for people who want to use Watir 6, but do not want the automatic waiting behaviors. (these are the people who had issues with the "Why are my tests taking so long?" section of the FAQ) Watir 7 will be deprecating this setting entirely, and relaxed_locate will be true for everyone. On Tuesday, September 11, 2018 at 7:40:29 AM UTC-7, NaviHan wrote: > > Hi Justin/Titus > > I have read the watit 6.0 release notes and FAQ @ > http://watir.com/watir-6-faq/#H > Thanks a lot for giving the valuable info. > > Until now I was under the impression that "element.when_present" & > "element.wait_until(&:present)", but reading the notes I understood that > they are different. > > Arent both waiting for deafult of "30" seconds for the element to be > present? What is the difference between the two? > > On Tuesday, 11 September 2018 14:52:33 UTC+10, NaviHan wrote: >> >> This is something that keeps me a bit sceptic when I write and read the >> automation code in my project. >> This used PageObjects. >> >> I have seen extensive use of element referces, for example >> >> button(:add_to_bag, :css => '#add-to-cart') >> add_to_bag.element.when_present.click >> >> >> >> instead of >> >> add_to_bag >> >> which directly clicks the element >> >> I have also seen extensive use of referencing elements using >> <element>.when_present, <element>.wait_until_present etc >> >> Im confused where we should draw the line when deciding to reference the >> element and actually using it(as in directly calling "add_o_bag" in the >> above example to click the element. >> >> Any thoughts? >> >> >> -- -- Before posting, please read https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.