Hi folks,

Please welcome the newest user of watir! I just heard about watir when searching for web automation, and after reading some how-to articles, I was quite excited with my first script running below (run fine in ubuntu x86, havent tried in mac or windows yet):

#### CODE START ####
#!/usr/bin/env ruby

require 'rubygems'
require 'watir'
require 'nokogiri'
#require 'watir-webdriver'

#start the browser up
#browser = Watir::Browser.new :chorme
browser = Watir::Browser.start "https://www.google.com/accounts/ServiceLogin?service=mail";

#pass in current page's html to nokogiri for parsing
page_html = Nokogiri::HTML.parse(browser.html)
text = page_html.xpath(".//*[@id='quota']").inner_text

while((text.to_f)<7621.000000)
  page_html = Nokogiri::HTML.parse(browser.html)
  text = page_html.xpath(".//*[@id='quota']").inner_text
  puts text
  sleep 2
end
#### CODE END ####

Since I am totally new to watir, I would appreciate any one helping me with my questions below:

* Main advantage of watir compared to traditional method (manual crawling), as far as I understand, is to reduce the number of automated queries sent to the interested page. With what I am doing above, am I doing it right? Is it considered as one query each time when I call page_html.xpath(".//*[@id='quota']").inner_text? If not, then anyone can explain to me how it is working?

* I have the feeling that the code above works as to extract infos from HTML code, whereas the quote produced from gmail is from a javascript. Is there a way that I capture infos from javascript instead of HTML code?

* Now if I want to *detect* the change of quota, meaning I want a kind of *real-time* code that reports me quota anytime when quote on gmail changes its value. Anyone can recommend me how to achieve that?

Thanks so much in advances, and sorry for many questions.

D.

--
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to