Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
kavitakanojiya
Posts : 2
Join date : 2012-03-27

Selenium Web Driver on Ruby on Rails 3 Empty Selenium Web Driver on Ruby on Rails 3

Tue Mar 27, 2012 1:01 pm
Hello,
I am quite new to Selenium. Currently i am using selenium driver for writing test cases in ruby on rails. In the application, I am required to login and Logout for each test cases. So, I exported each test cases from Selenium IDE to rails 3. I am required to use same browser session for multiple test cases within single browser. So I am calling Login test before required test case to be executed in a single ruby file. Is it possible to maintain browser session for consecutive next tests in rails 3 either with Selenium Client or Selenium Webdriver?
avatar
kavitakanojiya
Posts : 2
Join date : 2012-03-27

Selenium Web Driver on Ruby on Rails 3 Empty Re: Selenium Web Driver on Ruby on Rails 3

Thu Mar 29, 2012 8:19 pm
I got a solution for this issue for Selenium Client/Webdriver in Ruby on Rails 3. To maintain a session from test script to another script, the only thing you need is session variable. Since I have written different Login script and this script is being called in different other script files, so from this another file I have to access the session variable from Login script.
To access variable from Login script, the code inside is being converted to module.
This is how it worked for me:
----Start-----
------Login.rb-----
module ModuleName
def methodName
#----Write particular Login code required through selenium---#
@variable = SELENIUM::CLIENT:DRIVER.new \ #---Create browser instance and store in a variable ---#
return @variable #--Return back the variable from this method
end
end

------File1.rb-----
require Login.rb #---Specify with path---#
include ModuleName
Class File < TestCase #--Extending resp. Test Class
def setup
@local = ModuleName.methodName #--Access Module's method that will return session object.
end
def test_file
#--Access this @local in rest of the code--#
end
end
-----End----

This was the tweak to access variable from file1 to file2.
I hope this may help somebody......... cheers
Back to top
Permissions in this forum:
You cannot reply to topics in this forum