Skip to content

Instantly share code, notes, and snippets.

@twalpole
Created August 8, 2017 12:23
Show Gist options
  • Save twalpole/d9b65af23ad081ebfe956de84a7297b8 to your computer and use it in GitHub Desktop.
Save twalpole/d9b65af23ad081ebfe956de84a7297b8 to your computer and use it in GitHub Desktop.
require 'capybara/dsl'
require 'selenium-webdriver'
require 'byebug'
sess = Capybara::Session.new(:selenium_chrome, nil)
sess.visit('https://www.covergirl.com/en_us/')
el = sess.find('.global-header__list-link', wait: 5, match: :first, text: 'FACE').hover
sess.execute_script("
var evt = new MouseEvent('mouseenter', { bubbles: false, cancelable: true, view: window });
arguments[0].dispatchEvent(evt);
", el)
sess.find('.global-header__list-item--active a', text: 'Foundation').click
sess.assert_selector('h1', text: 'FOUNDATION')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment