3

I tried to run a simple script as follows to learn automation using watir-webdriver and Ruby. But I am getting no such class error -ffi_c.

class TestWatir
  require 'watir-webdriver'
  require 'cucumber'
  browser = Watir :: Browser.new :firefox
  browser.goto 'http://www.google.com'
end

I've added Cucumber and Watir-webdriver gems and also checked there is ffi dependency in the external library.

Stipe
  • 480
  • 5
  • 18
Rohin
  • 516
  • 3
  • 7
  • 20
  • What does your `Gemfile` look like? Did everything install successfully with `bundle install`? – tadman Jun 28 '16 at 15:45
  • line 4 should be `browser = Watir::Browser.new :firefox` (no spaces around `::`). – meatspace Jun 29 '16 at 16:49
  • possible duplicate of https://stackoverflow.com/q/65000467/12544391, e.g. adding `gem "ffi"` to `Gemfile` fixed it – Dorian Aug 23 '21 at 17:12

1 Answers1

3

I had this problem and resolved it by:

del Gemfile.lock
bundle clean --force
gem install bundler -v 1.12.1
gem install ffi -v 1.9.10 --platform=ruby
bundle install

It seams that some versions of ffi era labeled with the incorrect platform or something like that, that's bringing some problems on windows.

Hope it helps!

AxelWass
  • 1,321
  • 12
  • 21