18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

How to Run SAHI with Ruby?

tulachanashoktulachanashok Members
edited November -1 in Sahi - Open Source
Hi, I have been using SAHI for couple of months with javascript language. However, I was wondering if we could use it with ruby language as well. I've been also trying ruby with watir but i want to give a shot with sahi and see how efficient it is. Can you please explain in article how to execute the ruby script with sahi?

If you could do that, that would be great.

Thanks

Ash

Comments

  • narayannarayan Administrators
    Have you checked this? http://sahi.co.in/w/ruby
  • tulachanashoktulachanashok Members
    edited June 2011
    Thank you Narayan for your quick response.

    I tried to run the sample script after starting the sahi pro proxy. I got this 'Can't find Random Device' Error message. Can you help me on that?

    Loaded suite sahiruby
    Started
    E
    Finished in 1.046835 seconds.

    1) Error:
    test_google(SahiDriverTest):
    RuntimeError: Can't find random device
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/guid-0.1.1/lib/guid.rb:75:in `initialize'
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/sahi-1.0.1/lib/sahi.rb:84:in `new'
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/sahi-1.0.1/lib/sahi.rb:84:in `open'
    sahiruby.rb:8:in `setup'

    1 tests, 0 assertions, 0 failures, 1 errors, 0 skips

    Test run options: --seed 22068


    Also, i see the ruby code which uses .submit code. Can we use .button instead of that?


    Please reply me back at the earliest.

    Thanks

    Ash
  • This error comes because the guid source code checks the type of the OS via

    class Guid
    class << self
    def win32?
    RUBY_PLATFORM =~ /[^r]win/i
    end
    end
    end

    So please check what RUBY_PLATFORM returns on your OS, modify the guid.rb source code and run the script. It will resolve the issue.

    I also faced the same issue and I have changed the platform with "RUBY_PLATFORM =~ /i386/i" and did not see this again.

    Hope this will help you.
  • KarenKaren Members
    After updating guid.rb, I still get error "no such file to load --win32/process <LoadError>".

    Solution is install win32-process in command line
    D:\>gem install win32-process
Sign In or Register to comment.