Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

selenium (46) Versions 3.0.0

Installs/Configures Selenium

Policyfile
Berkshelf
Knife
cookbook 'selenium', '= 3.0.0', :supermarket
cookbook 'selenium', '= 3.0.0'
knife supermarket install selenium
knife supermarket download selenium
README
Dependencies
Changelog
Quality 100%

Selenium Cookbook

Cookbook Version
Build Status

This cookbook installs and configures Selenium (http://www.seleniumhq.org/).

This cookbook comes with the following recipes:

  • default - Downloads and installs Selenium Standalone jar.
  • hub - Installs and configures a Selenium Hub as a service.
  • node - Installs and configures a Selenium Node as service on Linux and a GUI service on Mac OS X and Windows.

LWRPs selenium_hub and
selenium_node are also available.

See selenium_grid cookbook for cross platform installs and configuration
of Selenium and 3rd party drivers.

Requirements

  • Java (not installed by this cookbook)
  • Chef 11.14+ (sensitive attribute introduced)

Platforms

  • CentOS, RedHat
  • Mac OS X
  • Ubuntu
  • Windows

Cookbooks

These cookbooks are referenced with suggests, so be sure to depend on cookbooks that apply:

  • windows
  • nssm - Required by Windows services only (e.g. Hub and HtmlUnit running in background)
  • macosx_autologin - Required by Mac OS X GUI services

Recipes

default

Downloads and installs Selenium Standalone jar.

Attributes

  • `node['selenium']['url'] - The download URL of Selenium Standalone jar.
  • node['selenium']['windows']['home'] - Home directory. Defaults to '#{ENV['SYSTEMDRIVE']}/selenium'
  • node['selenium']['windows']['java'] - Path to Java executable. Defaults to '#{ENV['SYSTEMDRIVE']}\java\bin\java.exe'
  • node['selenium']['unix']['home'] - Home directory. Defaults to ''/opt/selenium''
  • node['selenium']['unix']['java'] - Path to Java executable. Defaults to '/usr/bin/java'

hub

Installs and configures a Selenium Hub as a service.

Attributes

  • node['selenium']['hub']['service_name'] - The name of the service. Defaults to 'selenium_hub'
  • node['selenium']['hub']['host'] - Defaults to 'null'
  • node['selenium']['hub']['port'] - Defaults to 4444
  • node['selenium']['hub']['jvm_args'] - Defaults to nil
  • node['selenium']['hub']['newSessionWaitTimeout'] - Defaults to -1
  • node['selenium']['hub']['servlets'] - Defaults to []
  • node['selenium']['hub']['prioritizer'] - Defaults to 'null'
  • node['selenium']['hub']['capabilityMatcher'] - Defaults to 'org.openqa.grid.internal.utils.DefaultCapabilityMatcher'
  • node['selenium']['hub']['throwOnCapabilityNotPresent'] - Defaults to true
  • node['selenium']['hub']['nodePolling'] - Defaults to 5000
  • node['selenium']['hub']['cleanUpCycle'] - Defaults to 5000
  • node['selenium']['hub']['timeout'] - Defaults to 30_000
  • node['selenium']['hub']['browserTimeout'] - Defaults to 0
  • node['selenium']['hub']['maxSession'] - Defaults to 5
  • node['selenium']['hub']['jettyMaxThreads'] - Defaults to -1

node

Installs and configures a Selenium Node as service on Linux and a GUI service on Mac OS X and Windows.

  • Firefox browser must be installed outside of this cookbook.
  • Linux nodes without a physical monitor require a headless display (e.g., xvfb, x11vnc, etc...) and must be installed and configured outside this cookbook.
  • Mac OS X/Windows nodes (with the exception of HtmlUnitDriver) must run as a GUI service and that requires a username and password for automatic login. Note that Windows password is stored unencrypted under windows registry HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon and Mac OS X password is stored encrypted under /etc/kcpassword but it can be easily decrypted.

Attributes

  • node['selenium']['node']['service_name'] - The name of the service or Windows foreground startup script. Defaults to 'selenium_node'
  • node['selenium']['node']['host'] - Defaults to 'ip'
  • node['selenium']['node']['port'] - Defaults to 5555
  • node['selenium']['node']['jvm_args'] - Defaults to nil
  • node['selenium']['node']['proxy'] - Defaults to 'org.openqa.grid.selenium.proxy.DefaultRemoteProxy'
  • node['selenium']['node']['maxSession'] - Defaults to 5
  • node['selenium']['node']['register'] - Defaults to true
  • node['selenium']['node']['registerCycle'] - Defaults to 5000
  • node['selenium']['node']['hubPort'] - Selenium-grid hub hostname. Defaults to 4444
  • node['selenium']['node']['hubHost'] - Selenium-grid hub port. Defaults to 'ip'
  • node['selenium']['node']['capabilities'] - Based on capabilities. Defaults to [].
  • node['selenium']['node']['additional_args'] - Defaults to []
  • node['selenium']['node']['display'] - Defaults to ':0'
  • Mac OS X/Windows only - Set both username and password to run as a GUI service or leave nil to run service in background (HtmlUnit only):
    • username - Defaults to nil.
    • password - Defaults to nil. Note that Windows password is stored unencrypted under windows registry HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon and Mac OS X password is stored encrypted under /etc/kcpassword but it can be easily decrypted.
    • domain - Optional for Windows only. Defaults to nil.

Example

Install Selenium Node with Firefox and HtmlUnit capabilities

node.set['selenium']['node']['username'] = 'vagrant' if platform?('windows', 'mac_os_x')
node.set['selenium']['node']['password'] = 'vagrant' if platform?('windows', 'mac_os_x')

node.set['selenium']['node']['capabilities'] = [
  {
    browserName: 'firefox',
    maxInstances: 5,
    seleniumProtocol: 'WebDriver'
  },
  {
    browserName: 'htmlunit',
    maxInstances: 1,
    platform: 'ANY',
    seleniumProtocol: 'WebDriver'
  }
]

include_recipe 'selenium::node'

Resource/Providers

selenium_hub

Installs and configures a Selenium Hub as a service.

Attributes

This is a partial list of attributes available. See
hub
resource for the complete listing of attributes.

  • name - Name attribute. The name of the service.
  • host - Hostname. Defaults to null.
  • port - Port. Defaults to 4444.

selenium_node

Installs and configures a Selenium Node as a service.

Attributes

This is a partial list of attributes available. See
node
resource for the complete listing of attributes.

  • name - Name attribute. The name of the service or Windows foreground startup script.
  • host - Hostname. Defaults to null.
  • port - Port. Defaults to 5555.
  • hubHost - Selenium-grid hub hostname. Defaults to ip.
  • hubPort - Selenium-grid hub port. Defaults to 4444.
  • capabilities - Based on capabilities. Defaults to [].
  • Mac OS X/Windows only - Set both username and password to run as a GUI service or leave nil to run service in background (HtmlUnit only):
    • username - Defaults to nil.
    • password - Defaults to nil. Note that Windows password is stored unencrypted under windows registry HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon and Mac OS X password is stored encrypted under /etc/kcpassword but it can be easily decrypted.
    • domain - Optional for Windows only. Defaults to nil.

Example

Install Selenium Node with Firefox and HtmlUnit capabilities

selenium_node 'selenium_node' do
  username 'vagrant' if platform?('windows', 'mac_os_x')
  password 'vagrant' if platform?('windows', 'mac_os_x')
  capabilities [
    {
      browserName: 'firefox',
      maxInstances: 5,
      seleniumProtocol: 'WebDriver'
    },
    {
      browserName: 'htmlunit',
      maxInstances: 1,
      platform: 'ANY',
      seleniumProtocol: 'WebDriver'
    }
  ]
  action :install
end

ChefSpec Matchers

The Selenium cookbook includes custom ChefSpec matchers you can use to test
your own cookbooks.

Example Matcher Usage

expect(chef_run).to install_selenium_hub('resource_name').with(
  port: '4444'
)

Selenium Cookbook Matchers

  • install_selenium_hub(resource_name)
  • install_selenium_node(resource_name)

Getting Help

Contributing

Please refer to CONTRIBUTING.

License

MIT - see the accompanying LICENSE file for details.

Changelog

3.0.0 - 9/17/2015

  • Merge server recipe into default recipe
  • Replace server_version, release_url and override attributes with just url attribute
  • Replace server_name attribute and provision name attribute with just servername attribute
  • Move drivers to their own cookbooks
  • Remove PhantomJS

2.8.1 - 8/24/2015

  • Fix #20 Unable to set hub and node recipe attributes

2.8.0 - 8/21/2015

  • Add hub and node recipes

2.7.0 - 8/21/2015

  • Allow custom arguments to be added to node service
  • Allow custom download url for selenium standalone jar

2.6.0 - 8/2/2015

  • Support Safari

2.5.2 - 8/2/2015

  • Fix #18 Selenium iedriver does not extract

2.5.1 - 7/31/2015

  • Update Selenium and IE driver from 2.46.0 to 2.47.0
  • Update ChromeDriver from 2.15 to 2.16

2.5.0 - 7/29/2015

  • Deprecate PhantomJS

2.4.2 - 6/29/2015

  • Add powershell_version check

2.4.1 - 6/29/2015

  • Fix #16 Errror provisioning chromedriver on centos7
  • Fix #15 Drivers not copied to /selenium/drivers/ folders on Windows 7

2.4.0 - 6/9/2015

  • Allow resources to be globally configured

2.3.3 - 6/9/2015

  • Fix #13 org.openqa.selenium.WebDriverException: chrome not reachable on CentOS 7.0/Ubuntu 14.04

2.3.2 - 6/4/2015

  • Update Selenium and IE driver from 2.45.0 to 2.46.0

2.3.1 - 5/26/2015

  • Add supports 'mac_os_x' to metadata

2.3.0 - 5/26/2015

  • Add support for Mac OS X (Chef 11.14 or higher required)

2.2.6 - 5/26/2015

  • Fix #11 chromedriver version does not update
  • Update ChromeDriver from 2.14 to 2.15

2.2.5 - 5/1/2015

  • Fix #10 'failed to allocate memory' exception on Windows 2008

2.2.4 - 4/12/2015

  • Fix selenium_node provider depends on windows
  • Set Windows display resolution in selenium_test cookbook

2.2.3 - 3/23/2015

  • Wrap host and hubHost in quotes in node config
  • Update IE driver from 2.44.0 to 2.45.0

2.2.2 - 2/26/2015

  • Firefox 36 breaks WebDriver 2.44.0

2.2.1 - 2/18/2015

  • Update ChromeDriver from 2.12 to 2.14

2.2.0 - 2/5/2015

  • Make Windows service an option for HtmlUnit and PhantomJS

2.1.0 - 2/2/2015

  • Support HtmlUnit

2.0.0 - 2/2/2015

  • Replace PhantomJS attributes

1.0.0 - 2/1/2015

  • Initial release

Foodcritic Metric
            

3.0.0 passed this metric