Skip to content

Instantly share code, notes, and snippets.

@matisnape
Last active September 14, 2018 09:49
Show Gist options
  • Save matisnape/cfc4f3b605bb091c3b5239b17274c322 to your computer and use it in GitHub Desktop.
Save matisnape/cfc4f3b605bb091c3b5239b17274c322 to your computer and use it in GitHub Desktop.
Capybara - useful code snippets
loop do
break if profile_page.has_resume?
profile_page.execute_script(
"document.querySelector('.dialog-scroll-container').scrollTo(0, 1000);"
)
end
def select_question_type(qtype)
add_new_question.click
type.click
if qtype == question[:file]
scrollbar = find(:xpath, "//rt-dropdown//div[@class='ps-scrollbar-y-rail']//div")
2.times { scrollbar.send_keys(:down) }
loop do
page = Capybara.current_session.document
break if page.has_css?('rt-dropdown *', exact_text: question[:file])
scrollbar.send_keys(:down)
end
end
find(:xpath, "//rt-dropdown//*[contains(text(), '#{qtype}')]").click
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment