I have a Watir script that works against one of my sample sites. I'll provide that below. There's one part where I have to put a `sleep` statement. I'm curious how Watir can be used to handle this without the sleep statement. All of these will not work:
browser.element(:id, "navlist").wait_until(&:visible?).click browser.element(:id, "navlist").wait_until(&:present?).click browser.element(:id, "navlist").wait_until(&:enabled?).click Here is the script: #!/usr/bin/env ruby require 'rspec/expectations' include RSpec::Matchers require 'watir' browser = Watir::Browser.new browser.window.move_to 0, 0 width = browser.execute_script("return screen.width;") height = browser.execute_script("return screen.height;") browser.window.resize_to(width, height) browser.goto 'https://veilus.herokuapp.com' expect(browser.title).to match 'Veilus' expect(browser.img(:id, "site-image").exists?).to be_truthy browser.element(:id, "open").click browser.text_field(:id, "username").set! "admin" browser.text_field(:id, "password").set! "admin" browser.input(:id, "login-button").click login_text = browser.div(:class, "notice").text expect(login_text).to eq("You are now logged in as admin.") sleep 2 browser.element(:id, "navlist").click browser.link(:id, "stardate").click expect(browser.title).to match 'Stardate Calculator' expect(browser.url).to match 'stardate' expect(browser.img(:id, "stardate-logo").exists?).to be_truthy browser.quit You can see the sleep statement there before the navlist is clicked. If you take out the sleep, the script will fail. As mentioned, the waiting until aspects do not work because it's never the case that the element isn't there nor that it isn't visible. It's just that a put a little JavaScript in place that makes the element pop out after a brief delay. I'm just curious regarding what the idiomatic Watir solution for this would be. - Jeff -- -- Before posting, please read http://watir.com/support. 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.