'Automating Google Soccer 2012
I am trying to automate Google Soccer 2012, just for fun. I did not have any problems automating other Google games.
The problem with Soccer is that it does not react to left and right, but space works just fine.
This is the entire script:
puts "Go to game."
require "bundler/setup"
require "watir-webdriver"
browser = Watir::Browser.new :chrome
browser.goto "https://www.google.com/doodles/soccer-2012"
sleep 1
puts "Go!"
browser.div(id: "hplogo").frame.div.click
sleep 1
puts "Left!"
browser.send_keys :left
sleep 1
puts "Rigth!"
browser.send_keys :right
sleep 1
puts "Space!"
browser.send_keys :space
You can see code for Soccer and other games at https://github.com/zeljkofilipin/olympics
Anybody has an idea how to get left and right working?
Solution 1:[1]
sleep 3
puts "Left!"
browser.send_keys :left
you send the left and right keys too quickly. The animation doesn't seem to detect the input untill the animation has finished.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Simon |
