C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- watir (LoadError)

I'm new to Ruby and I have very little practice. I'm having difficulty compiling the instabot that is demonstrated in the following video: Build an Instagram autofollow bot

The error that appears is:

C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- watir (LoadError)
        from C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from auto_follow.rb:1:in `<main>'

My code is like this:

require 'watir '
require_relative 'credentials'

username = $username
password = $password

user = 'justinbieber'

#abrir o browser e navegar até a página de login

browser = Watir::Browser.new :chrome
browser.goto = "https://www.instagram.com/accounts/login/"

#navegando para os campos de login e senha e injetando informações
puts "Login in..."
browser.text_field(:name => "username").set "#{username}"
browser.text_field(:name => "password").set "#{password}"


#clicando no botao
browser.button(:class => '_ah57t _84y62 _i46jh _rmr7s').click

sleep(360)

Upvotes: 0

Views: 1366

Answers (1)

Tom Lord
Tom Lord

Reputation: 28305

You need to install the "watir" gem before you can require it in your code:

gem install watir

If you listen very carefully, around 1:00 the youtube video tells you this, but unhelpfully doesn't actually show it on screen :)

Upvotes: 1

Related Questions