0

I am new to Ruby, and trying to find a solution to convert existing ruby scripts to exe executables. I choose OCRA to convert ruby script to executbales. I am unable to convert this files to executable. The ocra conversition throwing error , that unable to load required libraries. Thanks in advance.

===========================================

require 'selenium-webdriver'
require 'page-object'

class SubjectSearchPage < CommonElement
  include PageObject

  text_field(:ssnField, :id => "SSN")
  button(:searchBtn, :css => 'button[data-test-id="20180820140732083632904"]')
  h2(:resultsHeaderTitle, :css => 'div[data-test-id="201808231334560745670_header"] h2.header-title')
  elements(:resultRows, :css => '#bodyTbl_right > tbody > tr')
  span(:result, :css => 'span[data-test-id="2016072109335505834280"]')

end

=======================================================

c:\Users\seshaddri\git\pega-functional-tests\selenium-ruby\pages\subject_mgmt>ocra subject_search_page.rb --add-all-core
=== Loading script to check dependencies
C:/Bitnami/rubystack-2.3.8-1/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- selenium-webdriver (LoadError)
        from C:/Bitnami/rubystack-2.3.8-1/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from c:/Users/seshaddri/git/pega-functional-tests/selenium-ruby/pages/subject_mgmt/subject_search_page.rb:2:in `<top (required)>'
        from C:/Bitnami/rubystack-2.3.8-1/ruby/lib/ruby/gems/2.3.0/gems/ocra-1.3.10/bin/ocra:1211:in `load'
        from C:/Bitnami/rubystack-2.3.8-1/ruby/lib/ruby/gems/2.3.0/gems/ocra-1.3.10/bin/ocra:1211:in `<top (required)>'
        from C:/Bitnami/rubystack-2.3.8-1/ruby/bin/ocra:23:in `load'
        from C:/Bitnami/rubystack-2.3.8-1/ruby/bin/ocra:23:in `<main>'
Aura
  • 1,283
  • 2
  • 16
  • 30
seshaddri
  • 5
  • 2
  • 3
    Possible duplicate of [Ruby selenium cannot load such file -- selenium-webdriver (LoadError)](https://stackoverflow.com/questions/22952022/ruby-selenium-cannot-load-such-file-selenium-webdriver-loaderror) – Stefan Crain Feb 25 '19 at 20:55
  • Ocra will not convert your code your binaries instead it will pack your project into exe, any one can see your source code. It will unpack your code you run. – Rajagopalan Feb 26 '19 at 04:46

1 Answers1

0

You just need to install the dependencies in your development environment and ocra will package them into the exe for you.

E.g. gem install selenium-webdriver

And then run the build again. Do this for all your projects dependencies.

Simon L. Brazell
  • 1,132
  • 8
  • 14
  • Thanks now i am getting different error what to do ?================`': uninitialized constant CommonElement (NameError) from C:/Bitnami/rubystack-2.3.8-1/ruby/lib/ruby/gems/2.3.0/gems/ocra-1.3.10/bin/ocra:1211:in `load' from C:/Bitnami/rubystack-2.3.8-1/ruby/lib/ruby/gems/2.3.0/gems/ocra-1.3.10/bin/ocra:1211:in `' from C:/Bitnami/rubystack-2.3.8-1/ruby/bin/ocra:23:in `load' from C:/Bitnami/rubystack-2.3.8-1/ruby/bin/ocra:23:in `
    '==================
    – seshaddri Feb 26 '19 at 15:29
  • Did you install the other dependencies also? Like `page-object`? – Simon L. Brazell Feb 27 '19 at 04:14