selenium-cucumber Ruby – How it works?

SC how it works

 

  • “.feature” file contain different testing scenarios and steps written in simple English language (Gherkin language).
  • You can write “Predefined Steps” and “Custom Steps” in “.feature” file.
  • Code for Predefined Steps already written in “selenium-cucumber lib” so you do not have to write separate code for it.
  • You can write code for Custom Steps in “custom_steps.rb” file or your own “.rb” file under step_definitions directory.
  • While adding separate “.rb” file for writing code for custom steps add                    “selenium-cucumber” library into your “.rb” file.
Advertisement

About Sameer Sawant

I am postgraduate in computer science from pune university. Working as QA Engineer in an IT company.
This entry was posted in Uncategorized and tagged , , , , , , , , . Bookmark the permalink.

3 Responses to selenium-cucumber Ruby – How it works?

  1. Mohan S says:

    how to swith to iframe

    Like

  2. Mohan S says:

    Then(/^I Switch to frame”(.*?)”$/) do |framename|
    switch_frame(framename)
    end

    def switch_frame(framename)
    $driver.switch_to.frame(framename)
    end

    i have added the above code in custom steps but still i am getting the error as undefined why ?

    Like

    • Sameer Sawant says:

      Following are steps and its implementation


      Scenario: switch to first frame
      Then I switch to new frame "frame_one"

      Scenario: switch to main window
      Then I switch to main window


      Then(/^I switch to main window$/) do
      $driver.switch_to.default_content
      end

      Then(/^I switch to new frame "(.*?)"$/) do |frame|
      $driver.switch_to.frame(frame)
      end

      Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s