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 5.0.0

Installs/Configures Selenium

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

Selenium Cookbook

Cookbook Version
linux
osx
win

This cookbook installs and configures Selenium 3+ (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.

Resources selenium_hub and
selenium_node are also available.

Usage

See selenium_grid cookbook that wraps selenium,
browsers, drivers, and screenresolution cookbooks into one comprehensive cookbook.

Requirements

  • Java (not installed by this cookbook)
  • Chef 12.6+

Platforms

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

Cookbooks

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

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. Default #{ENV['SYSTEMDRIVE']}/selenium.
  • node['selenium']['windows']['java'] - Path to Java executable. Default #{ENV['SYSTEMDRIVE']}\\java\\bin\\java.exe.
  • node['selenium']['unix']['home'] - Home directory. Default /opt/selenium.
  • node['selenium']['unix']['java'] - Path to Java executable. Default /usr/bin/java.

hub

Installs and configures a Selenium Hub as a service.

Attributes

See selenium_hub
resource attributes for description.

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 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

See selenium_hub
resource attributes for description.

Example

Install Selenium Node with Firefox and HtmlUnit capabilities

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

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

include_recipe 'selenium::node'

Resources

selenium_hub

Installs and configures a Selenium Hub as a service.

Attributes

  • servicename - Name attribute. The name of the service.
  • host - IP or hostname. Usually determined automatically. Most commonly useful in exotic network configurations (e.g. network with VPN). Default nil.
  • port - The port number the server will use. Default: 4444.
  • jvm_args - JVM options, e.g., -Xms2G -Xmx2G. Default: nil.
  • newSessionWaitTimeout - The time (in ms) after which a new test waiting for a node to become available will time out. When that happens, the test will throw an exception before attempting to start a browser. An unspecified, zero, or negative value means wait indefinitely. Default: -1.
  • prioritizer - A class implementing the Prioritizer interface. Specify a custom Prioritizer if you want to sort the order in which new session requests are processed when there is a queue. Default to null ( no priority = FIFO ).
  • servlets - List of extra servlets the grid (hub or node) will make available. The servlet must exist in the path, e.g., /grid/admin/Servlet. Default: [].
  • withoutServlets - List of default (hub or node) servlets to disable. Advanced use cases only. Not all default servlets can be disabled. Default: [].
  • capabilityMatcher - A class implementing the CapabilityMatcher interface. Specifies the logic the hub will follow to define whether a request can be assigned to a node. For example, if you want to have the matching process use regular expressions instead of exact match when specifying browser version. ALL nodes of a grid ecosystem would then use the same capabilityMatcher, as defined here. Default: org.openqa.grid.internal.utils.DefaultCapabilityMatcher
  • throwOnCapabilityNotPresent - If true, the hub will reject all test requests if no compatible proxy is currently registered. If set to false, the request will queue until a node supporting the capability is registered with the grid. Default: true.
  • cleanUpCycle - Specifies how often the hub will poll (in ms) running proxies for timed-out (i.e. hung) threads. Must also specify "timeout" option. Default: 5000.
  • debug - Enables LogLevel.FINE. Default: false.
  • timeout - Specifies the timeout before the server automatically kills a session that hasn't had any activity in the last X seconds. The test slot will then be released for another test to use. This is typically used to take care of client crashes. For grid hub/node roles, cleanUpCycle must also be set. Default: 1800.
  • browserTimeout - Number of seconds a browser session is allowed to hang while a WebDriver command is running (example: driver.get(url)). If the timeout is reached while a WebDriver command is still processing, the session will quit. Minimum value is 60. An unspecified, zero, or negative value means wait indefinitely. Default: 0.
  • maxSession - Max number of tests that can run at the same time on the node, irrespective of the browser used. Default: 5.
  • jettyMaxThreads - Max number of threads for Jetty. An unspecified, zero, or negative value means the Jetty default value (200) will be used. Default: -1.
  • log - The filename to use for logging. If omitted, will log to STDOUT. Default: nil.

selenium_node

Installs and configures a Selenium Node as a service.

Attributes

  • servicename - Name attribute. The name of the service.
  • host - IP or hostname. Usually determined automatically. Most commonly useful in exotic network configurations (e.g. network with VPN). Default nil.
  • port - The port number the server will use. Default: 5555.
  • hub - The url that will be used to post the registration request. Default: http://localhost:4444.
  • jvm_args - JVM options, e.g., -Xms2G -Xmx2G. Default: nil.
  • proxy - The class used to represent the node proxy. Default: org.openqa.grid.selenium.proxy.DefaultRemoteProxy.
  • maxSession - Max number of tests that can run at the same time on the node, irrespective of the browser used. Default: 5.
  • register - Node will attempt to re-register itself automatically with its known grid hub if the hub becomes unavailable. Default: true.
  • registerCycle - Specifies (in ms) how often the node will try to register itself again. Allows administrator to restart the hub without restarting (or risk orphaning) registered nodes. Must be specified with the "register" option. Default: 5000.
  • nodeStatusCheckTimeout - When to time out a node status check. Default: 5000.
  • nodePolling - Specifies (in ms) how often the hub will poll to see if the node is still responding. Default: 5000.
  • unregisterIfStillDownAfter - If the node remains down for more than specified (in ms), it will stop attempting to re-register from the hub. Default: 60000.
  • downPollingLimit - Node is marked as "down" if the node hasn't responded after the number of checks specified. Default: 2.
  • debug - [TrueClass, FalseClass], default: false
  • servlets - List of extra servlets the grid (hub or node) will make available. The servlet must exist in the path, e.g., /grid/admin/Servlet. Default: [].
  • withoutServlets - List of default (hub or node) servlets to disable. Advanced use cases only. Not all default servlets can be disabled. Default: [].
  • debug - Enables LogLevel.FINE. Default: false.
  • timeout - Specifies the timeout before the server automatically kills a session that hasn't had any activity in the last X seconds. The test slot will then be released for another test to use. This is typically used to take care of client crashes. For grid hub/node roles, cleanUpCycle must also be set. Default: 1800.
  • browserTimeout - Number of seconds a browser session is allowed to hang while a WebDriver command is running (example: driver.get(url)). If the timeout is reached while a WebDriver command is still processing, the session will quit. Minimum value is 60. An unspecified, zero, or negative value means wait indefinitely. Default: 0.
  • jettyMaxThreads - Max number of threads for Jetty. An unspecified, zero, or negative value means the Jetty default value (200) will be used. Default: -1.
  • log - The filename to use for logging. If omitted, will log to STDOUT. Default: nil.
  • capabilities - Based on capabilities. Default [].
  • Mac OS X/Windows only - Set both username and password to run as a GUI service:
    • username - Default nil.
    • password - Default 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. Default 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

This 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

5.0.0 2017-03-24

  • Rename display attribute to xdisplay to be Chef 13 compatible

4.1.0 2017-02-27

  • Selenium release 3.1.0

4.0.0 2017-02-17

  • Support Selenium 3.0
  • Log defaults to STDOUT when log attribute is nil
  • Drop support for Chef 11

3.7.4 2016-10-29

  • Fix #31 Adding support for selenium 3 in node config file

3.7.3 2016-08-22

  • Fix #29 Error executing action run on resource 'execute[reload org.seleniumhq.selenium_hub]'

3.7.2 2016-08-04

  • Fix #27 Cannot create directory due to insufficient permissions

3.7.1 2016-07-21

  • Selenium release 2.53.1

3.7.0 2016-06-25

  • Add support for systemd

3.6.1 2016-04-13

  • No more native HtmlUnitDriver, removed integration test
  • Include default recipe in provide only if required
  • Include windows::bootstrap_handler recipe in provide only if required

3.6.0 2016-03-22

  • Selenium release 2.53.0

3.5.0 2016-02-18

  • Selenium release 2.52.0

3.4.0 2016-02-10

  • Selenium release 2.51.0

3.3.1 2016-01-29

  • Selenium release 2.50.1

3.3.0 2016-01-28

  • Selenium release 2.50.0

3.2.1 2015-10-11

  • Selenium release 2.48.2

3.2.0 2015-10-07

  • Selenium release 2.48.0
  • Fix #23 WARN: Cannot create resource windows_service with more than one argument

3.1.1 2015-09-27

  • Fix #22 Firefox on Ubuntu fails to start

3.1.0 2015-09-26

  • Fix FC052: Metadata uses the unimplemented "suggests" keyword

3.0.0 2015-09-17

  • 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 2015-08-24

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

2.8.0 2015-08-21

  • Add hub and node recipes

2.7.0 2015-08-21

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

2.6.0 2015-08-02

  • Support Safari

2.5.2 2015-08-02

  • Fix #18 Selenium iedriver does not extract

2.5.1 2015-07-31

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

2.5.0 2015-07-29

  • Deprecate PhantomJS

2.4.2 2015-06-29

  • Add powershell_version check

2.4.1 2015-06-29

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

2.4.0 2015-06-09

  • Allow resources to be globally configured

2.3.3 2015-06-09

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

2.3.2 2015-06-04

  • Update Selenium and IE driver from 2.45.0 to 2.46.0

2.3.1 2015-05-26

  • Add supports 'mac_os_x' to metadata

2.3.0 2015-05-26

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

2.2.6 2015-05-26

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

2.2.5 2015-05-01

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

2.2.4 2015-04-12

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

2.2.3 2015-03-23

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

2.2.2 2015-02-26

  • Firefox 36 breaks WebDriver 2.44.0

2.2.1 2015-02-18

  • Update ChromeDriver from 2.12 to 2.14

2.2.0 2015-02-05

  • Make Windows service an option for HtmlUnit and PhantomJS

2.1.0 2015-02-02

  • Support HtmlUnit

2.0.0 2015-02-02

  • Replace PhantomJS attributes

1.0.0 2015-02-01

  • Initial release

Collaborator Number Metric
            

5.0.0 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

5.0.0 passed this metric

Foodcritic Metric
            

5.0.0 passed this metric

License Metric
            

5.0.0 passed this metric

No Binaries Metric
            

5.0.0 passed this metric

Testing File Metric
            

5.0.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

5.0.0 passed this metric