Last active
September 14, 2018 09:49
-
-
Save matisnape/cfc4f3b605bb091c3b5239b17274c322 to your computer and use it in GitHub Desktop.
Capybara - useful code snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loop do | |
break if profile_page.has_resume? | |
profile_page.execute_script( | |
"document.querySelector('.dialog-scroll-container').scrollTo(0, 1000);" | |
) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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