# Calling different methods in a single file

**URL:** <https://www.ruby-forum.com/t/calling-different-methods-in-a-single-file/123563>\
**Category:** Ruby\
**Created:** [December 18, 2007, 7:42pm UTC](https://www.ruby-forum.com/t/calling-different-methods-in-a-single-file/123563 "2007-12-18T19:42:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c67d28/32.png) [@rubist](https://www.ruby-forum.com/u/rubist)\
**Post date:** [December 18, 2007, 7:42pm UTC](https://www.ruby-forum.com/t/calling-different-methods-in-a-single-file/123563/1 "2007-12-18T19:42:40Z")

</div>

Hi All,  
I was able to successfully create a class file login and login into my  
application using ruby code.  
I have created one more class file which selects drop down values in my  
app.  
I am not able to call both the class files at once, it says Method not  
defined!!!  
I wanted to know whether for each class file i need to initialize  
Please let me know if any more information is required on this issue .  
My code looks like this:

Class file 1:  
require ‘selenium’  
class Zlogin  
def initialize(userId,password)  
@userId=userId  
@password=password  
puts ‘intialize user and password’  
end  
def abc\_login  
selenium.set\_speed “200”  
selenium.open “/cvis”  
selenium.type “userId”,@userId  
selenium.type “password”,@password  
selenium.click “//input[@value=‘Login’]”  
puts ‘Login Sucess’  
end  
//Code  
Similary Class file 2:  
equire “selenium”  
CODE//  
class Price  
puts " Now Price loading will start"  
def Price(selenium)  
puts “Start PRICE”  
selenium.set\_timeout “60000”  
selenium.select “ddlbClientList”, “label=CLIENT”  
selenium.set\_timeout “60000”  
selenium.click “btnSubmit”  
selenium.wait\_for\_page\_to\_load “500000”  
selenium.click “link=Data”  
//CODE

MAIN File calling class 1 & 2  
CODE//  
require “Zlogin”  
require "Price "

z = Zlogin.new(“admin”,“admin”)  
selenium=z.getSelenium  
selenium.start  
z.abc\_login(selenium)

puts “Now Price Method to be called”  
lp=Price .new  
lp.Price(selenium)  
//CODE

I am not able to call Class 2 file…!! anything wrong in my code!!
