Variable area c in another ruby ​​file

I am launching a website with a different functional page. I make different modules for each function. The problem is that I have a Login.rb login page that has the following code: -

$IE = Watir::IE.new_process

module Login

  def Login.login(url)
    $IE.goto("url")
    sleep (4)
    $IE.maximize
    #$IE.span(:class =>'menuLink', :text =>'Image').click
  end
end

I need to access the IE variable for my other module methods. the problem is that other modules that are in another .rb file do not accept this variable. help me how sholud i declare this so that i can use it in all my modules in different files.

+3
source share
1 answer

. () common.rb .

. - script , .

module Browser
  def self.ie
    @ie ||= Watir::IE.new_process
  end
end
+1

Source: https://habr.com/ru/post/1762230/


All Articles