Skip to content

Instantly share code, notes, and snippets.

@rafaellima
Created June 3, 2014 21:01
Show Gist options
  • Save rafaellima/ecefb6e8f28f0096a12d to your computer and use it in GitHub Desktop.
Save rafaellima/ecefb6e8f28f0096a12d to your computer and use it in GitHub Desktop.
found = false
(1..5).each do |index|
sleep 1
os_name = (@driver.find_element(:xpath, "html/body/div[1]/ul/li[1]/ul/li[15]/ul/li[#{index}]/ul/li[1]/span[2]").text)
if os_name == "\"Linux Debian 7\""
!60.times{ break if (@driver.find_element(:xpath, "html/body/div[1]/ul/li[1]/ul/li[15]/ul/li[#{index}]/ul/li[2]/span[2]").text == "\"SVNLICDLD02\"" rescue false); sleep 1 }
(@driver.find_element(:xpath, "html/body/div[1]/ul/li[1]/ul/li[15]/ul/li[#{index}]/ul/li[2]/span[2]").text).should == "\"SVNLICDLD02\""
!60.times{ break if (@driver.find_element(:xpath, "html/body/div[1]/ul/li[1]/ul/li[15]/ul/li[#{index}]/ul/li[3]/span[2]").text == "0" rescue false); sleep 1 }
(@driver.find_element(:xpath, "html/body/div[1]/ul/li[1]/ul/li[15]/ul/li[#{index}]/ul/li[3]/span[2]").text).should == "0"
!60.times{ break if (@driver.find_element(:xpath, "html/body/div[1]/ul/li[1]/ul/li[15]/ul/li[#{index}]/ul/li[4]/span[2]").text == "\"64\"" rescue false); sleep 1 }
(@driver.find_element(:xpath, "html/body/div[1]/ul/li[1]/ul/li[15]/ul/li[#{index}]/ul/li[4]/span[2]").text).should == "\"64\""
!60.times{ break if (@driver.find_element(:xpath, "html/body/div[1]/ul/li[1]/ul/li[15]/ul/li[#{index}]/ul/li[5]/span[2]").text == "\"debian_7\"" rescue false); sleep 1 }
(@driver.find_element(:xpath, "html/body/div[1]/ul/li[1]/ul/li[15]/ul/li[#{index}]/ul/li[5]/span[2]").text).should == "\"debian_7\""
!60.times{ break if (@driver.find_element(:xpath, "html/body/div[1]/ul/li[1]/ul/li[15]/ul/li[#{index}]/ul/li[6]/span[2]").text == "\"per_cpu\"" rescue false); sleep 1 }
(@driver.find_element(:xpath, "html/body/div[1]/ul/li[1]/ul/li[15]/ul/li[#{index}]/ul/li[6]/span[2]").text).should == "\"per_cpu\""
sleep 1
found = true
end
end
raise Exception unless found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment