Hi I found Watir and am excited to use it. I cannot find much examples in terms of data scraping. I have gotne to a point wherei can use it to submit form details. I need to scrape data from the tables etc. How do i do it. For eg my if ie is my browser object, how do i get the tables in the page and extract data from 3 table in the page into a array? Pl help. Seede
on 2006-07-08 19:29
on 2006-07-08 22:05
On Jul 8, 2006, at 19:25, junkone@rogers.com wrote: > Hi > I found Watir and am excited to use it. I cannot find much examples in > terms of data scraping. I have gotne to a point wherei can use it to > submit form details. > I need to scrape data from the tables etc. How do i do it. > For eg my if ie is my browser object, how do i get the tables in the > page and extract data from 3 table in the page into a array? Watir is a wrapper around MSIE. In my limited experience crawling with Watir, besides reading its documentation I think it's good to study the underlying API, available here: http://msdn.microsoft.com/library/default.asp?url=/workshop/ browser/mshtml/reference/reference.asp In particular the interfaces IWebBrowser2, IHTMLDocument2, and IHTMLDocument3: http://msdn.microsoft.com/workshop/browser/webbrow... ifaces/iwebbrowser2/iwebbrowser2.asp http://msdn.microsoft.com/workshop/browser/mshtml/... document2/document2.asp http://msdn.microsoft.com/workshop/browser/mshtml/... document3/document3.asp There you see what can be done grabbing the ie attribute of the Watir::IE object, in case the wrapping interface does not address some particular need. Additionally, I have found reading watir.rb very instructive, you have a better knowledge of what you are doing and may give context and idioms. -- fxn
on 2006-07-08 22:35
Xavier Noria wrote: > On Jul 8, 2006, at 19:25, junkone@rogers.com wrote: > There you see what can be done grabbing the ie attribute of the > Watir::IE object, in case the wrapping interface does not address some > particular need. Additionally, I have found reading watir.rb very > instructive, you have a better knowledge of what you are doing and may > give context and idioms. About a year or so ago I poked around trying to get HTML from IE in Watir. The problem (and maybe this has changed) was that the IE object did not have a way to get the literal text currently in the browser; there was no COM 'view|source', so to speak. What it exposed was access to IE's internal node tree, which is *not* what is in the browser. IE adds all sorts of things (for DHTML and such, as well as, I think, the various implied attributes defined in the HTML DTD. Something akin to the post-schema infoset, I think.) so it is useless for verifying server output. Still, it is handy in other ways; you can locate, say, table elements and td content and so on. I wrote a method that did a recursive walk down the internal IE tree and created an XML string from it. Contact me off-list if you would like me to send it to you. It's old and may not work with the current Watir, but might give you some ideas. james DOT britt AT gmail DOT com -- James Britt http://www.ruby-doc.org - Ruby Help & Documentation http://www.artima.com/rubycs/ - The Journal By & For Rubyists http://www.rubystuff.com - The Ruby Store for Ruby Stuff http://refreshingcities.org - Design, technology, usability
on 2006-07-09 02:00
On Jul 8, 2006, at 22:04, Xavier Noria wrote: > On Jul 8, 2006, at 19:25, junkone@rogers.com wrote: > >> Hi >> I found Watir and am excited to use it. I cannot find much >> examples in >> terms of data scraping. I have gotne to a point wherei can use it to >> submit form details. >> I need to scrape data from the tables etc. How do i do it. >> For eg my if ie is my browser object, how do i get the tables in the >> page and extract data from 3 table in the page into a array? > There you see what can be done grabbing the ie attribute of the > Watir::IE object, in case the wrapping interface does not address > some particular need. Additionally, I have found reading watir.rb > very instructive, you have a better knowledge of what you are doing > and may give context and idioms. By the way, regarding the question about tables you can do this: table = ie.table(:index, 3) That index is 1-based and returns an object of type Watir::Table or nil. As per the definition of order between tables, it is delegated to IE this way: @ieController.document.getElementsByTagName("TABLE") -- fxn
on 2006-07-10 23:15
You should be able to do something like Browser.html() To grab the original source. There is also a Watir specific newsgroup somewhere around rubyforge.
on 2006-07-10 23:37
Alan Ark wrote: > You should be able to do something like > > Browser.html() > > To grab the original source. Well, that *would* save a good deal of trouble. Thanks! -- James Britt "You harmonize; then you customize." - Wilson Pickett
on 2006-07-11 00:32
On Jul 10, 2006, at 23:13, Alan Ark wrote: > You should be able to do something like > > Browser.html() > > To grab the original source. What do you mean? Watir::IE#html gives a dump of the internal MSIE representation, tags are in uppercase, quotes are removed from some attributes, etc. What James mentioned a few messages above. -- fxn
on 2009-01-20 16:41
Hi All, I really need some help here. I am a recruiter and my client has been looking for QAs with Ruby -Watir experience. They are located at San Francisco, CA. Pay is as per market rate. Please mail me back at lgeorge@everesttech.com with resume if interested. I would also appreciate any referrals. Thanks Leah
on 2011-10-17 13:48
Hi this is Bhaskar Munnuri.I have a doubt the the watir is an pure object oriented programming language or not if yes how.why because it does not support multiple inheritance directly so how the oops concept can satisfies
on 2011-10-18 00:01
On Mon, Oct 17, 2011 at 6:48 AM, bhaskar m. <bhaskar.munnuri@gmail.com> wrote: > Hi this is Bhaskar Munnuri.I have a doubt the the watir is an pure > object oriented programming language or not > if yes how.why because it does not support multiple inheritance directly > so how the oops concept can satisfies Watir is not a language at all; it is a library written in Ruby. Ruby is generally considered a pure object-oriented language, since every value is a full-fledged object (i.e. it responds to methods, etc.) -- unless in languages like C++ or Java where you have types like int and double which are not objects. Multiple inheritance is actually pretty rare in object-oriented languages; language designers seem to generally consider multiple inheritance to cause a lot of difficulties in implementation. Many languages have a construct similar (but not identical) to a class, which allows for some of the things you might use multiple base classes for in a language like C++. For example, Java and C# have interfaces, and Objective-C has protocols. Ruby has modules, also known as mixins. Still, inheritance in general isn't emphasized in Ruby.
on 2013-03-11 13:38
Hi, Does anyone knows how can I access or click on the data inside the "var createMenuItems" in the attachment. This are menu dropdowns created when I click on a particular tag(not included in the attachment). Any help is greatly appreciated. Thanks.
on 2013-03-11 13:54
I'm not sure about Watir, but in Watir-Webdriver you extract script
content like this:
driver.scripts[index].html
or
driver.scripts.each { |s| puts s.html }
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.