Note that there are some explanatory texts on larger screens.

plurals
  1. POundefined method 'find_element' for Selenium::WebDriver:Module when using method from another module
    primarykey
    data
    text
    <p>Hello I am new to programming working on Selenium using Ruby and I'm having some trouble. I am trying to call a method from a class in another module so I can create a sort of method library and every time I am returned the error <code>NoMethodError: undefined method 'find_element' for Selenium::WebDriver:Module</code> I have require_relative "LeadForm" to require the other module and the code works properly when I put the method directly into the class I'm using it in but I would really like to just have it written once because this is something I will be using a lot. </p> <p>The code is</p> <blockquote> <p>def self.progCNA </p> <p>Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "area_of_study")).select_by(:text, "Health &amp; Medical / Nursing") Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "concentration")).select_by(:text, "Nursing Assistant (CNA)")</p> <p>end</p> </blockquote> <p>and when I call it in the the class that runs the test I put</p> <blockquote> <p>LeadForm.progCNA</p> </blockquote> <p>and it appears to recognize and run the method but then the method errors out. </p> <p>Any help would be greatly appreciated as this has been a source of a lot of frustration and I can't for the life of me find a solution online. I have looked up, down and sideways. If you require any more information from me please let me know and I will get it to you as soon as possible! Thank you very much.</p> <p>I'm using Windows 7 Pro sp1 JetBrains RubyMine 4.5.3 Ruby 1.9.3 selenium-webdriver 2.25.0</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload