Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elearningplugins/7db630b81dc073f989dd4d12710dd606 to your computer and use it in GitHub Desktop.
Save elearningplugins/7db630b81dc073f989dd4d12710dd606 to your computer and use it in GitHub Desktop.
quick example
require 'selenium-webdriver'
driver = Selenium::WebDriver.for :chrome
wait = Selenium::WebDriver::Wait.new(:timeout => 15)
driver.manage.window.maximize
url = "https://mywebsite.com"
contact_case_url = url + "/support/contact/case"
driver.get url
driver.manage.timeouts.implicit_wait=(10)
driver.get contact_case_url
#GOLDEN PATH TEST CASE
#handle find your answer now modal
driver.find_element(:partial_link_text, "like to submit a case").click
driver.find_element(:id, "support_case_first_name").send_keys("First")
driver.find_element(:id, "support_case_last_name").send_keys("Last")
driver.find_element(:id, "support_case_email_address").send_keys("myemail@email.com")
#click on product dropdown
dropdown_product_name = driver.find_element(id: "support_case_product_name")
select_list = Selenium::WebDriver::Support::Select.new(dropdown_product_name)
select_list.select_by(:text, 'Storyline')
#click on product version dropdown
dropdown_product_version = driver.find_element(id: "support_case_product_version")
select_list = Selenium::WebDriver::Support::Select.new(dropdown_product_version)
select_list.select_by(:text, 'Storyline 360')
driver.find_element(:id, "support_case_description").send_keys("This is a description")
driver.find_element(:id, "support_case_forums_url").send_keys("awebsite.com")
#driver.find_element(:class, "btn--secondary btn--xsmall").click
driver.find_element(:id, "support_case_captcha").send_keys(math_captcha_answer)
#verify What info should you include? modal
driver.find_element(:partial_link_text, "What info should you include").click
got_it_button = driver.find_element(:xpath, "//SPAN[@class='btn--primary'][text()='Got It']")
got_it_button.click
sleep(60)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment