Display results as :

Rechercher Advanced Search

Latest topics
» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

» How to work on pages with AJAX in selenium?
Mon Sep 18, 2017 6:08 pm by azharuddin

» pause test until user press a key like F2
Wed Aug 09, 2017 11:10 pm by djnforce

» Selecting the input for auto populating element
Sat Jul 29, 2017 7:53 pm by kdabbara


Selenium Web Driver on Ruby on Rails 3

View previous topic View next topic Go down

Selenium Web Driver on Ruby on Rails 3

Post by kavitakanojiya on Tue Mar 27, 2012 1:01 pm

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?


Posts : 2
Join date : 2012-03-27

Back to top Go down

Re: Selenium Web Driver on Ruby on Rails 3

Post by kavitakanojiya on 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:
module ModuleName
def methodName
#----Write particular Login code required through selenium---#
@variable = \ #---Create browser instance and store in a variable ---#
return @variable #--Return back the variable from this method

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.
def test_file
#--Access this @local in rest of the code--#

This was the tweak to access variable from file1 to file2.
I hope this may help somebody......... cheers


Posts : 2
Join date : 2012-03-27

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum