Code Monkey home page Code Monkey logo

chef-selenium's People

Contributors

balazsadam avatar dhoer avatar mhemesath avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

chef-selenium's Issues

Auto Generate Capabilities

If you are interested, I wrapped your cookbook and updated it to auto-install the browsers and build the capabilities. If this is something you are interested in I can contribute this work back. This allows me to create roles that activate a browser for a given selenium node. Making it super easy to add/remove browsers to a given node without changing any attributes.

caps = []
if node['selenium']['node']['chrome']
  include_recipe 'chrome::default'
  caps.push({
      browserName: 'chrome',
      maxInstances: 5,
      seleniumProtocol: 'WebDriver'
  })
end

if node['selenium']['node']['firefox']
  include_recipe "firefox::default"
  caps.push({
      browserName: 'firefox',
      maxInstances: 2,
      seleniumProtocol: 'WebDriver'
  })
end

selenium_node 'selenium_node' do
  hubHost node['selenium']['node']['hubHost']
  capabilities caps
  action :install
end

chromedriver version does not update

This is on Windows.

If I change default['selenium']['chromedriver_version'] to a newer version then re-run the recipe it does not update the chrome driver version.

The chromedriver recipe uses not_if checks on "#{link}/chromedriver.exe" which will exist after the first run. Instead should it check for the dir with the specific version you are trying to provision, updating the existing link if install was required?

Include chromedriver version in capabilities file

It would be useful to see what version of chrome driver is in use on a node from the grid/console page.

I'd like it to keep track of the version installed when the node is configured and included this in the capabilities object.

I assume you're already doing something for the Chrome version that's been installed as this is already included in the capabilities object for the node:
capabilities: Capabilities [{seleniumProtocol=WebDriver, browserName=chrome, maxInstances=1, version=56.0.2924.87, platform=WIN8}]

I'm fairly new to chef but if you point me in the write direction I'm happy to have a go at implementing this.

Error executing action `run` on resource 'execute[reload org.seleniumhq.selenium_hub]'

Stacktrace:

       * execute[reload org.seleniumhq.selenium_hub] action run

         ================================================================================
         Error executing action `run` on resource 'execute[reload org.seleniumhq.selenium_hub]'
         ================================================================================

         Mixlib::ShellOut::ShellCommandFailed
         ------------------------------------
         Expected process to exit with [0, 112], but received '1'
         ---- Begin output of launchctl unload -w /Library/LaunchDaemons/org.seleniumhq.selenium_hub.plist; launchctl load -w /Library/LaunchDaemons/org.seleniumhq.selenium_hub.plist ----
         STDOUT: 
         STDERR: launchctl: Couldn't stat("/Library/LaunchDaemons/org.seleniumhq.selenium_hub.plist"): No such file or directory
         nothing found to unload
         launchctl: Couldn't stat("/Library/LaunchDaemons/org.seleniumhq.selenium_hub.plist"): No such file or directory
         nothing found to load
         ---- End output of launchctl unload -w /Library/LaunchDaemons/org.seleniumhq.selenium_hub.plist; launchctl load -w /Library/LaunchDaemons/org.seleniumhq.selenium_hub.plist ----
         Ran launchctl unload -w /Library/LaunchDaemons/org.seleniumhq.selenium_hub.plist; launchctl load -w /Library/LaunchDaemons/org.seleniumhq.selenium_hub.plist returned 1

         Resource Declaration:
         ---------------------
         # In /tmp/kitchen/cache/cookbooks/selenium/libraries/default.rb

         140:   execute "reload #{name}" do
         141:     command "launchctl unload -w #{plist}; launchctl load -w #{plist}"
         142:     user username
         143:     action :nothing
         144:     returns [0, 112] # 112 not logged into gui
         145:   end
         146: 

         Compiled Resource:
         ------------------
         # Declared in /tmp/kitchen/cache/cookbooks/selenium/libraries/default.rb:140:in `selenium_mac_service'

         execute("reload org.seleniumhq.selenium_hub") do
    action [:nothing]
    retries 0
    retry_delay 2
    default_guard_interpreter :execute
    command "launchctl unload -w /Library/LaunchDaemons/org.seleniumhq.selenium_hub.plist; launchctl load -w /Library/LaunchDaemons/org.seleniumhq.selenium_hub.plist"
    backup 5
    returns [0, 112]
    declared_type :execute
    cookbook_name "selenium"
         end

         Platform:
         ---------
         x86_64-darwin13.0

selenium iedriver and chromedriver

Hi

i try to use the node that install the iedriver .
the driver did not extract to the C:\selenium\drivers\iedriver-2.46.0
in exist in the C:\chef\cache IEDriverServer_x64_2.46.0.zip

with the chromedriver it is ok

i look in the code and found that the implementation with the iedriver and the chromedriver are not that same

change the iedriver like the chromedriver fix the problem

Fixes #10: windows_zipfile rubyzip failure to allocate memory (requires PowerShell 3 or greater & .NET Framework 4)

batch 'unzip iedriver' do
code "powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem';"
" [IO.Compression.ZipFile]::ExtractToDirectory('#{zip}', '#{iedriver_dir}'); }""
action :nothing
only_if { powershell_version >= 3 }
end

windows_zipfile iedriver_dir do
source zip
action :nothing
not_if { powershell_version >= 3 }
end

remote_file 'download iedriver' do
  path zip
  source "#{node['selenium']['release_url']}/#{selenium_version(version)}/IEDriverServer_#{bit}_#{version}.zip"
  use_etag true
  use_conditional_get true
  notifies :run, 'batch[unzip iedriver]', :immediately 
  notifies :unzip, "windows_zipfile[#{iedriver_dir}]", :immediately 

end

thank zacky

Support for Selenium 3

I just tested this cookbook with Selenium 3 (both hub and node) and it works fine, except for one minor problem that causes the node to crash when starting:

Exception in thread "main" org.openqa.grid.common.exception.GridConfigurationException: Error with the JSON of the config : Deprecated -nodeConfig file encountered. Please update the file to work with Selenium 3. See https://github.com/SeleniumHQ/selenium/wiki/Grid2#configuring-the-nodes-by-json for more details.

This can be solved by changing https://github.com/dhoer/chef-selenium/blob/master/templates/default/node_config.erb moving all the keys from the "configuration" node one level up and removing the "configuration" node itself.

I can work on a pull request if this sounds reasonable, but I guess it would make sense to check for the Selenium version being used and use the correct format accordingly?

selenium_node provider depends on windows

Trying to use the selenium_node provider on ubuntu 14.04 and it fails unless I include a dependency on the windows cookbook. Seems like the reference to the windows_reboot resource is the issue.

[2015-04-10T18:54:26+00:00] ERROR: selenium_node[selenium_node] (my-cookbook::node line 5) 
had an error: 
NoMethodError: No resource or method named `windows_reboot' for `Chef::Provider::SeleniumNode ""'

Errror provisioning chromedriver on centos7

When running on my centos7 vm (which correctly identifies as centos platform) I run into trouble with this line.

==> default: 
==> default: NoMethodError
==> default: -------------
==> default: No resource or method named `windows_zipfile' for `Chef::Recipe "chromedriver"'
==> default: 
==> default: Cookbook Trace:
==> default: ---------------
==> default:   /tmp/vagrant-chef/ac4c8aa2284621160c918e90286c6b9e/cookbooks/selenium/recipes/chromedriver.rb:34:in `rescue in from_file'
==> default:   /tmp/vagrant-chef/ac4c8aa2284621160c918e90286c6b9e/cookbooks/selenium/recipes/chromedriver.rb:27:in `from_file'
==> default: 
==> default:   /tmp/vagrant-chef/ac4c8aa2284621160c918e90286c6b9e/cookbooks/mcr-selenium-grid/recipes/default.rb:14:in `from_file'
==> default: 
==> default: Relevant File Content:
==> default: ----------------------
==> default: /tmp/vagrant-chef/ac4c8aa2284621160c918e90286c6b9e/cookbooks/selenium/recipes/chromedriver.rb:
==> default: 
==> default: 
==> default:  27:  begin
==> default:  28:    batch 'unzip chromedriver' do
==> default: 
==> default:  29:      code "powershell.exe -nologo -noprofile -command \"& { Add-Type -A 'System.IO.Compression.FileSystem';"\
==> default:  30:        " [IO.Compression.ZipFile]::ExtractToDirectory('#{cache_path}', '#{driver_path}'); }\""
==> default:  31:      action :nothing
==> default:  32:    end
==> default: 
==> default:  33:  rescue # cheesy attempt at backward compatibility
==> default: 
==> default:  34>>   windows_zipfile driver_path do
==> default:  35:      source cache_path
==> default: 
==> default:  36:      action :unzip
==> default:  37:    end
==> default: 
==> default:  38:  end
==> default:  39:  
==> default: 
==> default:  40:  execute 'unzip chromedriver' do
==> default:  41:    command "unzip -o #{cache_path} -d #{driver_path} && chmod -R 0755 #{driver_path}"
==> default: 
==> default:  42:    action :nothing
==> default: 
==> default:  43:  end

I can work around this by wrapping this whole begin/rescue/end with a if platform?('windows') but not sure if that's just fixing the symptom rather than the root cause?

It feels like this block shouldn't be evaluated if we are not on Windows?

Any assistance would be great, happy to do a PR and add any tests just want to be sure I understand the intention?

Cheers,
Matt.

Drivers not copied to /selenium/drivers/ folders on Windows 7

I updated to the latest 2.4.0 tag and it seems on Windows 7 the IE and chrome drivers do not copy to the correct file location where selenium expects them when running the node recipe. I confirmed that the drivers are downlaoded to the chef cache, they just are never copied into the selenium driver folder.

Does this work for you? This recipe was working in previous versions so not sure if something on my system changed, or if an update to the recipe broke it.

ip:4444/wd/hub show stacktrace

i have a strange error when i go to the hub ip:4444/wd/hub
i get the following stacktrace

{"status":13,"value":{"class":"java.lang.NullPointerException","stackTrace":[{"fileName":"ExternalSessionKey.java","className":"org.openqa.grid.internal.ExternalSessionKey","methodName":"fromWebDriverRequest","lineNumber":77},{"fileName":"WebDriverRequest.java","className":"org.openqa.grid.web.servlet.handler.WebDriverRequest","methodName":"extractSession","lineNumber":62},{"fileName":"RequestHandler.java","className":"org.openqa.grid.web.servlet.handler.RequestHandler","methodName":"getSession","lineNumber":237},{"fileName":"RequestHandler.java","className":"org.openqa.grid.web.servlet.handler.RequestHandler","methodName":"process","lineNumber":119},{"fileName":"DriverServlet.java","className":"org.openqa.grid.web.servlet.DriverServlet","methodName":"process","lineNumber":83},{"fileName":"DriverServlet.java","className":"org.openqa.grid.web.servlet.DriverServlet","methodName":"doGet","lineNumber":61},{"fileName":"HttpServlet.java","className":"javax.servlet.http.HttpServlet","methodName":"service","lineNumber":707},{"fileName":"HttpServlet.java","className":"javax.servlet.http.HttpServlet","methodName":"service","lineNumber":820},{"fileName":"ServletHolder.java","className":"org.seleniumhq.jetty7.servlet.ServletHolder","methodName":"handle","lineNumber":565},{"fileName":"ServletHandler.java","className":"org.seleniumhq.jetty7.servlet.ServletHandler","methodName":"doHandle","lineNumber":479},{"fileName":"SessionHandler.java","className":"org.seleniumhq.jetty7.server.session.SessionHandler","methodName":"doHandle","lineNumber":225},{"fileName":"ContextHandler.java","className":"org.seleniumhq.jetty7.server.handler.ContextHandler","methodName":"doHandle","lineNumber":1031},{"fileName":"ServletHandler.java","className":"org.seleniumhq.jetty7.servlet.ServletHandler","methodName":"doScope","lineNumber":406},{"fileName":"SessionHandler.java","className":"org.seleniumhq.jetty7.server.session.SessionHandler","methodName":"doScope","lineNumber":186},{"fileName":"ContextHandler.java","className":"org.seleniumhq.jetty7.server.handler.ContextHandler","methodName":"doScope","lineNumber":965},{"fileName":"ScopedHandler.java","className":"org.seleniumhq.jetty7.server.handler.ScopedHandler","methodName":"handle","lineNumber":117},{"fileName":"HandlerWrapper.java","className":"org.seleniumhq.jetty7.server.handler.HandlerWrapper","methodName":"handle","lineNumber":111},{"fileName":"Server.java","className":"org.seleniumhq.jetty7.server.Server","methodName":"handle","lineNumber":349},{"fileName":"AbstractHttpConnection.java","className":"org.seleniumhq.jetty7.server.AbstractHttpConnection","methodName":"handleRequest","lineNumber":452},{"fileName":"BlockingHttpConnection.java","className":"org.seleniumhq.jetty7.server.BlockingHttpConnection","methodName":"handleRequest","lineNumber":47},{"fileName":"AbstractHttpConnection.java","className":"org.seleniumhq.jetty7.server.AbstractHttpConnection","methodName":"headerComplete","lineNumber":884},{"fileName":"AbstractHttpConnection.java","className":"org.seleniumhq.jetty7.server.AbstractHttpConnection$RequestHandler","methodName":"headerComplete","lineNumber":938},{"fileName":"HttpParser.java","className":"org.seleniumhq.jetty7.http.HttpParser","methodName":"parseNext","lineNumber":634},{"fileName":"HttpParser.java","className":"org.seleniumhq.jetty7.http.HttpParser","methodName":"parseAvailable","lineNumber":230},{"fileName":"BlockingHttpConnection.java","className":"org.seleniumhq.jetty7.server.BlockingHttpConnection","methodName":"handle","lineNumber":66},{"fileName":"SocketConnector.java","className":"org.seleniumhq.jetty7.server.bio.SocketConnector$ConnectorEndPoint","methodName":"run","lineNumber":254},{"fileName":"QueuedThreadPool.java","className":"org.seleniumhq.jetty7.util.thread.QueuedThreadPool","methodName":"runJob","lineNumber":599},{"fileName":"QueuedThreadPool.java","className":"org.seleniumhq.jetty7.util.thread.QueuedThreadPool$3","methodName":"run","lineNumber":534},{"fileName":"Thread.java","className":"java.lang.Thread","methodName":"run","lineNumber":745}]}}

have you seen such errors?
or have any idea how to solve this
because there is nothing in the log files

Rubyzip failure to allocate memory issue on Windows Server 2008

On Windows Server 2008 & 2008R2 the following exception occurs:

================================================================================
  Error executing action `install` on resource 'chef_gem[rubyzip]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of C:/opscode/chef/embedded/bin/gem install rubyzip -q --no-rdoc --no-ri -v "1.1.7" ----
STDOUT:
  STDERR: [FATAL] failed to allocate memory
---- End output of C:/opscode/chef/embedded/bin/gem install rubyzip -q --no-rdoc --no-ri -v "1.1.7" ----
Ran C:/opscode/chef/embedded/bin/gem install rubyzip -q --no-rdoc --no-ri -v "1.1.7" returned 1

This does NOT happen on Windows Server 2012 & 2012 R2.

recipes are not idempotent

We'd like to wrap these recipes in an internal cookbook and set chef for continuous runs but the recipes have resources, such as the selenium install ps1 script that converge every time. It'd be cool if these resources could be wrapped in intelligent guards to prevent needless execution.

Problem with Java executable location

Installing on Windows, I set default['selenium']['windows']['java'] to be some path other than cookbook default, but Chef runs always use default. If I instead set default['selenium']['java'], my path overrides the default as desired. This is what made me think to make this change.

Is it possible this isn't working? Or am I doing this wrong?

Cannot create directory due to insufficient permissions

================================================================================
Error executing action `install` on resource 'selenium_node[selenium_node]'
================================================================================

Chef::Exceptions::InsufficientPermissions
-----------------------------------------
directory[C:\Users\test_user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup] (C:/Users/TEST_U~1/AppData/Local/Temp/kitchen/cache/cookbooks/selenium/libraries/default.rb line 49) had an error: Chef::Exceptions::InsufficientPermissions: Cannot create directory[C:\Users\test_user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup] at C:\Users\test_user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup due to insufficient permissions

Release 3.0.0

Enhancements to be addressed in 3.0 release:

  • Replace windows cookbook with Chef 12 functionality
  • Replace nssm with Chef 12 service
  • Remove PhantomJS
  • Replace registry with windows_autologin
  • Add module to library or prefix methods with selenium_
  • Rename name attribute to servicename
  • Make selenium user the default user that will be created on all platforms? (maybe)

Firefox on Ubuntu fails to start

When running Firefox on Ubuntu you get the following error:

 Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:

   (process:14883): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
   Xlib:  extension "RANDR" missing on display ":0".
   ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
   ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
   ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
   ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
   ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
   ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
   ALSA lib conf.c:4727:(snd_config_expand) Evaluate error: No such file or directory
   ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
    (org.openqa.selenium.firefox.NotConnectedException)
        # [remote server] org.openqa.selenium.firefox.internal.NewProfileExtensionConnection(NewProfileExtensionConnection.java):122:in `start'
        # [remote server] org.openqa.selenium.firefox.FirefoxDriver(FirefoxDriver.java):276:in `startClient'
        # [remote server] org.openqa.selenium.remote.RemoteWebDriver(RemoteWebDriver.java):116:in `<init>'
        # [remote server] org.openqa.selenium.firefox.FirefoxDriver(FirefoxDriver.java):223:in `<init>'
        # [remote server] org.openqa.selenium.firefox.FirefoxDriver(FirefoxDriver.java):216:in `<init>'
        # [remote server] org.openqa.selenium.firefox.FirefoxDriver(FirefoxDriver.java):134:in `<init>'
        # [remote server] sun.reflect.NativeConstructorAccessorImpl(NativeConstructorAccessorImpl.java):-2:in `newInstance0'
      # [remote server] sun.reflect.NativeConstructorAccessorImpl(NativeConstructorAccessorImpl.java):62:in `newInstance'
        # [remote server] sun.reflect.DelegatingConstructorAccessorImpl(DelegatingConstructorAccessorImpl.java):45:in `newInstance'
        # [remote server] java.lang.reflect.Constructor(Constructor.java):422:in `newInstance'
        # [remote server] org.openqa.selenium.remote.server.DefaultDriverProvider(DefaultDriverProvider.java):103:in `callConstructor'
        # [remote server] org.openqa.selenium.remote.server.DefaultDriverProvider(DefaultDriverProvider.java):97:in `newInstance'
        # [remote server] org.openqa.selenium.remote.server.DefaultDriverFactory(DefaultDriverFactory.java):60:in `newInstance'
        # [remote server] org.openqa.selenium.remote.server.DefaultSession$BrowserCreator(DefaultSession.java):222:in `call'
        # [remote server] org.openqa.selenium.remote.server.DefaultSession$BrowserCreator(DefaultSession.java):1:in `call'
        # [remote server] java.util.concurrent.FutureTask(FutureTask.java):266:in `run'
        # [remote server] org.openqa.selenium.remote.server.DefaultSession$1(DefaultSession.java):176:in `run'
        # [remote server] java.util.concurrent.ThreadPoolExecutor(ThreadPoolExecutor.java):1142:in `runWorker'
        # [remote server] java.util.concurrent.ThreadPoolExecutor$Worker(ThreadPoolExecutor.java):617:in `run'
        # [remote server] java.lang.Thread(Thread.java):745:in `run'
        # /tmp/verifier/gems/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/response.rb:71:in `assert_ok'
        # /tmp/verifier/gems/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/response.rb:34:in `initialize'
        # /tmp/verifier/gems/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/http/common.rb:78:in `new'
        # /tmp/verifier/gems/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/http/common.rb:78:in `create_response'
        # /tmp/verifier/gems/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/http/default.rb:90:in `request'
        # /tmp/verifier/gems/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
        # /tmp/verifier/gems/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/bridge.rb:657:in `raw_execute'
        # /tmp/verifier/gems/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/bridge.rb:122:in `create_session'
        # /tmp/verifier/gems/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/bridge.rb:87:in `initialize'
        # /tmp/verifier/gems/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/common/driver.rb:52:in `new'
        # /tmp/verifier/gems/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/common/driver.rb:52:in `for'
        # /tmp/verifier/gems/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver.rb:86:in `for'
        # ./firefox_spec.rb:5:in `block (2 levels) in <top (required)>'
        # /tmp/verifier/gems/gems/busser-rspec-0.7.5/lib/busser/rspec/runner.rb:23:in `<main>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.