cookbook 'selenium', '= 1.0.0'
selenium
(46) Versions
1.0.0
-
Follow14
Installs/Configures Selenium
cookbook 'selenium', '= 1.0.0', :supermarket
knife supermarket install selenium
knife supermarket download selenium
Selenium Cookbook
This cookbook installs and configures Selenium and WebDriver components (http://www.seleniumhq.org/).
This cookbook comes with the following Resource/Providers:
- selenium_hub - Installs and configures selenium-grid hubs.
- selenium_node - Installs and configures selenium-grid nodes with support for ChromeDriver, InternetExplorerDriver, and FirefoxDriver.
- selenium_phantomjs - Installs and configures PhantomJS as a selenium-grid node or as a standalone server via GhostDriver.
Roadmap
Add support for the following (any volunteers?):
- HtmlUnit
- Mac OS X platform and SafariDriver
- Appium
Requirements
Chef 11 or greater
Platforms
- CentOS, RedHat
- Ubuntu
- Windows
Cookbooks
These cookbooks are referenced with suggests, so be sure to depend on cookbooks that apply:
- windows
- nssm - Windows hubs only
Usage
See selenium_test
cookbook for working cross platform examples, and
default attributes for global
cookbook settings.
Note that the provided examples in this cookbook have passwords unencrypted for simplicity.
selenium_hub
Installs and configures selenium-grid hubs.
Requirements
- Java must be installed outside of this cookbook.
Example
Install selenium-grid hub
selenium_hub 'selenium_hub' do username 'Administrator' if platform?('windows') password 'password' if platform?('windows') action :install end
Attributes
See hub resource for a complete list
of attributes.
-
name
- Name attribute. The name of the service. -
host
- Hostname. Defaults tonull
if nil. -
port
- Port. Defaults to4444
if nil. -
jvm_args
- Jvm arguments (e.g., -Xmx256M) Optional. Defaults tonil
selenium_node
Installs and configures selenium-grid nodes with support for
ChromeDriver,
InternetExplorerDriver, and
FirefoxDriver.
Requirements
- Java must be installed outside of this cookbook.
- Browsers (e.g., chrome, firefox, etc...) 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.
- Windows nodes require an account (e.g., username/password/domain) for auto-logon. Note that the password is
stored unencrypted under windows registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
.
Example
Install selenium-grid node with Chrome, Firefox and Internet Explorer capability
selenium_node 'selenium_node' do username 'Administrator' if platform?('windows') password 'password' if platform?('windows') capabilities [ { browserName: 'chrome', maxInstances: 5, seleniumProtocol: 'WebDriver' }, { browserName: 'firefox', maxInstances: 5, seleniumProtocol: 'WebDriver' }, { browserName: 'internet explorer', maxInstances: 1, seleniumProtocol: 'WebDriver' } ] action :install end
Attributes
See node resource for a complete list
of attributes.
-
name
- Name attribute. The name of the service or auto-logon script (Windows nodes only). -
host
- Hostname. Defaults to null if nil. -
port
- Port. Defaults to 4444 if nil. -
hubHost
- Selenium-grid hub hostname. Defaults toip
if nil. -
hubPort
- Selenium-grid hub port. Defaults to4444
. -
jvm_args
- Jvm arguments (e.g., -Xmx256M) Optional. Defaults tonil
. -
capabilities
- The following drivers are supported and installed based on capabilities:-
ChromeDriver -
Installed if capabilities contains browser name
chrome
-
InternetExplorerDriver -
32-bit or 64-bit installed if capabilities contains browser name
internet explorer
- FirefoxDriver - Pre-installed with Selenium server
-
ChromeDriver -
Installed if capabilities contains browser name
-
username
- Windows account username. Required for Windows only. -
password
- Windows account password. Required for Windows only. -
domain
- Windows account domain. Optional. Defaults tonil
.
selenium_phantomjs
Installs and configures PhantomJS as a selenium-grid node or as a standalone server via
GhostDriver.
Requirements
- PhantomJS must be installed outside of this cookbook.
Examples
Install PhantomJS as a selenium-grid node
selenium_phantomjs 'selenium_phantomjs' do username 'Administrator' if platform?('windows') password 'password' if platform?('windows') action :install end
Install PhantomJS as a standalone server by setting hubHost to false
selenium_phantomjs 'selenium_phantomjs_nogrid' do username 'Administrator' if platform?('windows') password 'password' if platform?('windows') hubHost false action :install end
Attributes
See phantomjs resource for a complete list
of attributes.
-
name
- Name attribute. The name of the service or auto-logon script (Windows nodes only). -
host
- Webdriver hostname. Defaults tonode['ipaddress']
. Used in conjunction withhost
to generatewebdriver
parameter. -
port
- Webdriver port. Defaults to8910
. Used in conjunction withhost
to generatewebdriver
parameter. -
hubHost
- Selenium-grid hub hostname. Defaults tonode['ipaddress']
. Set to false to install PhantomJS as a standalone service. Used in conjunction withhubPort
to generatewebdriverSeleniumGridHub
parameter. -
hubPort
- Selenium-grid hub port. Defaults to4444
. Used in conjunction withhubHost
to generatewebdriverSeleniumGridHub
parameter. -
username
- Windows account username. Required for Windows only. -
password
- Windows account password. Required for Windows only. -
domain
- Windows account domain. Optional. Defaults tonil
.
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)
- install_selenium_phantomjs(resource_name)
Getting Help
- Ask specific questions on Stack Overflow.
- Report bugs and discuss potential features in Github issues.
Contributing
Please refer to CONTRIBUTING.
License
MIT - see the accompanying LICENSE file for details.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
Changelog
1.0.0
- Initial release
Foodcritic Metric
1.0.0 passed this metric
1.0.0 passed this metric