我是Ruby的新手,我的练习很少。我在编辑以下视频中演示的instabot时遇到了困难: Build an Instagram autofollow bot
出现的错误是:
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>'
我的代码是这样的:
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)
答案 0 :(得分:1)
您需要安装&#34; watir&#34;宝石之前你可以require
代码:
gem install watir
如果你仔细聆听,around 1:00 youtube视频会告诉你这一点,但没有用,实际上并没有在屏幕上显示:)