browser.element(:id, "navlist").wait_until(&:visible?).click
browser.element(:id, "navlist").wait_until(&:present?).click
browser.element(:id, "navlist").wait_until(&:enabled?).click#!/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.quitbrowser.element(:id, "navlist")browser.element(:id, "navlist")Is it a pop up?And are you aware that `set!` function is using JavaScript not Selenium send_keys?
sleep 2
browser.element(:id, "navlist").click--
--
Before posting, please read http://watir.com/support. In short: search before you ask, be nice.
watir-...@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You have to look at what is different in the condition you want vs the condition you don't.In this case you want to wait for `element.div(id: 'areas').style('left') == '-50em'` (or something)If you have open the inspector you can see that value changing during page load.
browser.wait_until { browser.element(:id, "navlist").style("right") == "-20px" }browser.wait_until { browser.element(:id, "areas").style("left") == "-50em" }Call the style('left') method after your sleep to see what the correct final value is. I didn't actually test it.