Skip to content

Instantly share code, notes, and snippets.

/noobloo.rb Secret

Created September 29, 2015 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/c850c1b24da267ce4f89 to your computer and use it in GitHub Desktop.
Save anonymous/c850c1b24da267ce4f89 to your computer and use it in GitHub Desktop.
require 'pry'
require 'open-uri'
require 'nokogiri'
url = "http://www.tristar.eu/pt/Electr%C3%B3nica/Boombox/Radio_Stereo_CD/CD-1568/3/5277"
doc = Nokogiri::HTML(open(url))
stuff = doc.xpath(' //*[(@id = "Gegevens")]//li').collect {|node| node.text.strip}
## for each ittem in 'stuff', in this case 7 strings, i need to perform...
driver.find_element(:id,"add").click
driver.find_element(:id, "f04_0001").send_keys(stuff[1])
driver.find_element(:id,"add").click
driver.find_element(:id, "f04_0002").send_keys(stuff[2])
driver.find_element(:id,"add").click
driver.find_element(:id, "f04_0003").send_keys(stuff[3])
driver.find_element(:id,"add").click
driver.find_element(:id, "f04_0004").send_keys(stuff[4])
driver.find_element(:id,"add").click
driver.find_element(:id, "f04_0005").send_keys(stuff[5])
driver.find_element(:id,"add").click
driver.find_element(:id, "f04_0006").send_keys(stuff[6])
driver.find_element(:id,"add").click
driver.find_element(:id, "f04_0007").send_keys(stuff[7])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment