title: Is it better idea to save elements in yml file?
body: <p>I'm writing automated tests using Selenium WebDriver with Ruby. So, I'm thinking to keep elements in another file and actual code in another file. And for Ruby, I found <code>yaml</code> gem which allows to store data and access it. Hence I stored elements in <code>lib.yml</code> and test code in <code>test.rb</code> as following:</p>
  
  <p><strong>lib/lib.yml</strong></p>
  
  <pre><code>homepage:
    frame: 'mainPage'
    email: 'loginPage-email'
    password: 'loginPage-password'
    login_button: 'btnLogin'
  </code></pre>
  
  <p><strong>tests/test.rb</strong></p>
  
  <pre><code>require 'selenium-webdriver'
  require 'yaml'
  
  driver = Selenium::WebDriver.for :firefox
  
  driver.get 'http://www.abc.com'
  
  config = YAML.load_file('./lib/lib.yml')
  
  driver.switch_to.frame(config['homepage']['frame'])
  
  email = driver.find_element(:id, config['homepage']['email'])
  password = driver.find_element(:id, config['homepage']['password'])
  
  email.clear
  email.send_keys 'abc@gmail.com'
  
  password.clear
  password.send_keys 'password'
  
  driver.find_element(:id, config['homepage']['login_button']).click
  
  driver.quit
  </code></pre>
  
  <p>This way maintenance becomes easier. I just want to make sure if doing so is a good way or not. I'm asking because I'm trying this first time and don't know what difficulties I'll run into if I choose this for larger project.</p>
  
  <p>I know, using Page object model, we can achieve same thing. But I don't know about Page object. So should I avoid using <code>yml</code> gem and directly go for <code>page object</code> gem?</p>
  
  <p>Also, can someone explain how using <code>yml</code> will not be good idea(if it's not)?</p>
  
  <p><strong>Note:</strong></p>
  
  <ol>
  <li>In above code, <code>config['homepage']['something']</code> is repetitive code. I'll write method to avoid repetition for that.</li>
  </ol>