You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
click_link('id-of-link')click_link('Link Text')click_button('Save')click('Link Text')# Click either a link or a buttonclick('Button Value')
Interacting with Forms
fill_in('First Name',:with=>'John')fill_in('Password',:with=>'Seekrit')fill_in('Description',:with=>'Really Long Text…')find('#people_search_last_name').set('Huber')choose('A Radio Button')check('A Checkbox')# Checkfind(:css,"#cityID").set(true)# Uncheckfind(:css,"#cityID").set(false)uncheck('A Checkbox')attach_file('Image','/path/to/image.jpg')select('Option',:from=>'Select Box')select('Anruf',:from=>'people_search_activity_character')# people_search_activity_character is the id of the select-box
save_and_open_pageputspage.html}File.open("test_#{Time.now.to_i}.html",'w'){ |f| f << page.html}page.driver.render("test_#{Time.now.to_i}.png",:full=>true)
Asynchronous JavaScript
find('input[name="post[title]"]').trigger('focus')#allows triggering of custom events. Works with Javascript driversclick_link('foo')click_link('bar')page.shouldhave_content('baz')page.should_nothave_xpath('//a')page.shouldhave_no_xpath('//a')