cheezy / rdee Goto Github PK
View Code? Open in Web Editor NEWDynamically create a connection for Selenium or Watir.
License: MIT License
Dynamically create a connection for Selenium or Watir.
License: MIT License
using both
RDee.configure do |c|
c.url = 'http://192.168.10.10:4444/wd/hub'
end
browser = RDee.selenium_browser
and
RDee.configure do |c|
c.url = 'http://192.168.10.10:4444/wd/hub'
end
browser = RDee.watir_browser
gives me the error
Timeout::Error
Timeout::Error (RDee::ConnectionError)
C:/tools/ruby193/lib/ruby/gems/1.9.1/gems/RDee-0.3/lib/rdee/browser_factory.rb:48:in `rescue in selenium_browser_for'
C:/tools/ruby193/lib/ruby/gems/1.9.1/gems/RDee-0.3/lib/rdee/browser_factory.rb:40:in `selenium_browser_for'
C:/tools/ruby193/lib/ruby/gems/1.9.1/gems/RDee-0.3/lib/rdee/browser_factory.rb:21:in `selenium_browser'
C:/tools/ruby193/lib/ruby/gems/1.9.1/gems/RDee-0.3/lib/RDee.rb:92:in `selenium_browser'
C:/Users/tyler.thrailkill/Documents/recondo/tools/watir2_0/trunk/features/support/env.rb:96:in `create_browser'
C:/Users/tyler.thrailkill/Documents/recondo/tools/watir2_0/trunk/features/support/hooks.rb:3:in `<top (required)>'
C:/tools/ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.0/lib/cucumber/rb_support/rb_language.rb:94:in `load'
C:/tools/ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.0/lib/cucumber/rb_support/rb_language.rb:94:in `load_code_file'
C:/tools/ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.0/lib/cucumber/runtime/support_code.rb:237:in `load_file'
C:/tools/ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.0/lib/cucumber/runtime/support_code.rb:97:in `block in load_files!'
C:/tools/ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.0/lib/cucumber/runtime/support_code.rb:96:in `each'
C:/tools/ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.0/lib/cucumber/runtime/support_code.rb:96:in `load_files!'
C:/tools/ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.0/lib/cucumber/runtime.rb:242:in `load_step_definitions'
C:/tools/ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.0/lib/cucumber/runtime.rb:65:in `run!'
C:/tools/ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.0/lib/cucumber/cli/main.rb:38:in `execute!'
C:/tools/ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.0/bin/cucumber:9:in `<top (required)>'
C:/tools/ruby193/bin/cucumber:23:in `load'
C:/tools/ruby193/bin/cucumber:23:in `<top (required)>'
-e:1:in `load'
-e:1:in `<main>'
I'm unsure of what I'm doing wrong.
The cucumber.yml looks like this
% common = "FIG_NEWTON_FILE=server1.yml RDEE_BROWSER=chrome -r features"
% pretty_format = "--color --format pretty"
% html_format = "--format html --out cucumber_run_output/html_report/report.html"
% json_format = "--format json --out cucumber_run_output/json_reports/report.json"
% exclude = "-t ~@wip -t ~@not_ready"
default: <%= common %> <%= pretty_format %> <%= html_format %> <%= exclude %>
See Apple doc: https://support.apple.com/kb/SP702?locale=en_US
Typo in RDee/lib/rdee/additional_options.rb #22
def need_ie_optons?(target)
Yes, there is an I in options!
Looking at the RDee code, it appears that :desired_capabilities is overwritten as it is explicitly set after the options.merge
def platform_and_options(target, options)
target = ENV['RDEE_BROWSER'].to_sym if ENV['RDEE_BROWSER']
platform, version, host = parse(target)
options.merge! additional_options_for target
capabilities = capabilities(platform, version, host)
options[:url] = url unless url.nil?
if options.include? :url
platform = :remote
options[:desired_capabilities] = capabilities
end
options[:http_client] = http_client if persistent_http or options.delete(:persistent_http)
return platform, options
end
as such, how can we add our own desired capabilities @cheezy ?
Hi Cheezy, first off - great gem!
I need to add preferences for my remote browser, for example here is a copy of my local chrome configuration:
$download_directory = File.join("#{Dir.pwd}/_cucumber", 'tmp_downloads')
FileUtils.mkdir_p $download_directory
prefs = {
download: {
prompt_for_download: false,
directory_upgrade: true,
default_directory: $download_directory
},
safebrowsing: {
enabled: true
}
}
switches = %w(--ignore-certificate-errors --disable-popup-blocking)
caps = Selenium::WebDriver::Remote::Capabilities.chrome
caps['chromeOptions'] = { 'prefs' => prefs }
@browser = RDee.watir_browser(target = :chrome, options = {prefs: prefs, switches: switches})
end
This works great locally, however when I try to run on a remote machine with the following:
Before('@remote_chrome') do
$download_directory = File.join("#{Dir.pwd}/_cucumber", 'tmp_downloads')
FileUtils.mkdir_p $download_directory
prefs = {
download: {
prompt_for_download: false,
directory_upgrade: true,
default_directory: $download_directory
},
safebrowsing: {
enabled: true
}
}
switches = %w(--ignore-certificate-errors --disable-popup-blocking)
caps = Selenium::WebDriver::Remote::Capabilities.chrome
caps['chromeOptions'] = { 'prefs' => prefs }
@browser = RDee.watir_browser(target = :chrome, options = {url: 'http://192.168.99.100:4444/wd/hub', prefs: prefs, switches: switches})
end
The above throws an error
'unknown options: {:prefs=>{:download=>{:prompt_for_download=>false, :directory_upgrade=>true, :default_directory=>"/Users/Ian/Documents/workspace/_cucumber/tmp_downloads"}, :safebrowsing=>{:enabled=>true}}, :switches=>["--ignore-certificate-errors", "--disable-popup-blocking"]}'
I've tried several variations on the above without success. Any idea where I am going wrong?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.