Selenium problem with Watir and Opera in RubyMine
Im trying to create an instance of Opera using Watir in Rubymine using these lines:
require "rubygems"
require "watir-webdriver"
browser = Watir::Browser.new :opera
but that returns an error of
/Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/opera/service.rb:14:in `selenium_server_jar': Unable to find the Selenium server jar. Please download the standalone server from http://code.google.com/p/selenium/downloads/list and set the SELENIUM_SERVER_JAR environmental variable to its location. More info at http://code.google.com/p/selenium/wiki/OperaDriver. (Selenium::WebDriver::Error::WebDriverError)
However if i run these commands in irb i dont get this problem.
I think it has something to do with the fact that ive set up the export SELENIUM_SERVER_JAR=/usr/bin/selenium-server-standalone-2.10.0.jar variable in my .bash.profile in my users/tom/ folder.
I assume that RubyMine must be looking in a difference place than this to get the variable but im not sure where its looking. If someone could point me in the right direction that would be great
请先登录再写评论。
Hello Tom,
this is happening due to the way Mac OS X handles environment variables. Please see this doc to setup environment variables to be picked up by RubyMine.