Re: [Wtr-general] parsing fields
I suggest using rubyful-soup, which parses html. I found it to be pretty slick, althought some people complain that it is slow.BretOn 6/27/06, Beth Ferguson <[EMAIL PROTECTED]> wrote:Hi Bret- ie.div(:style, 'display:none').html only gives me an error message whichreads: "unknown way of finding a DIV ( {what} )"perhaps i should be a bit more explicit. I need to parse thisinformation. the information is hidden in a form and it is a way for me to make logical choices about what to do in the form without hardcoding anindex value or a name. so- if i could load all the elements into an array,that would be all i would need. I can do the array bit, i just can't figure out how to get ruby/watir to recognize or find the elements. wouldthe html parse module be a way to go?Thanks-Beth basefrm Application Monitoring Application Library /gateway/infrastructure/Library.do Application Groups /gateway/infrastructure/Group.do ___Wtr-general mailing list Wtr-general@rubyforge.orghttp://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] parsing fields
Hi Bret- ie.div(:style, 'display:none').html only gives me an error message which reads: "unknown way of finding a DIV ( {what} )" perhaps i should be a bit more explicit. I need to parse this information. the information is hidden in a form and it is a way for me to make logical choices about what to do in the form without hardcoding an index value or a name. so- if i could load all the elements into an array, that would be all i would need. I can do the array bit, i just can't figure out how to get ruby/watir to recognize or find the elements. would the html parse module be a way to go? Thanks- Beth basefrm Application Monitoring Application Library /gateway/infrastructure/Library.do Application Groups /gateway/infrastructure/Group.do ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Interesting link problem
I have a table that dynamically has an "n" number of entries as links. The table can sort by the last entry made in the table. I want to be able to click on the last entry or the last link that appears on the table. The problem is that I don't have attribute values to able to identify the link I want. I can't access the link by the inner text value because the text is also dyanmic. I will not know the name of the link until I access the page. The name changes as the table grows. So I'm not sure how to click on the link I want.Below is some of the html code and a list of the attributes from the sample. As you can see I don't have much that I can search by. Does anybody have any idea how I can click on the first link?AUTOTEST8142855 Joe Player autouser9 [EMAIL PROTECTED] 0.00 Sterling 2006-06-23 01:00:33.0 Active 1966-09-02 1 AUTOTEST9229432 Joe Player autouser9 [EMAIL PROTECTED] 0.00 Sterling 2006-06-23 00:51:27.0 Active 1966-09-02 1 AUTOTEST8570615 Joe Player autouser9 [EMAIL PROTECTED] 0.00 Sterling 2006-06-23 00:45:51.0 Active 1966-09-02 1 AUTOTEST6130026 Joe Player autouser9 [EMAIL PROTECTED] 0.00 Sterling 2006-06-23 00:37:37.0 Active 1966-09-02 1 --- http://admin-cqa-wpt-sat02.corp.wagerworks.com/WagerWareAdminwpt/accounts/browseAccount.do?playerCode=2606 inner text: AUTOTEST8142855 type: link id: name: value: disabled: false href: http://admin-cqa-wpt-sat02.corp.wagerworks.com/WagerWareAdminwpt/accounts/browseAccount.do?playerCode=2605 inner text: AUTOTEST9229432 type: link id: name: value: disabled: false href: http://admin-cqa-wpt-sat02.corp.wagerworks.com/WagerWareAdminwpt/accounts/browseAccount.do?playerCode=2603 inner text: AUTOTEST8570615 type: link id: name: value: disabled: false href: http://admin-cqa-wpt-sat02.corp.wagerworks.com/WagerWareAdminwpt/accounts/browseAccount.do?playerCode=2602 inner text: AUTOTEST6130026 type: link id: name: value: disabled: false ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] parsing fields
Does ie.div(:style, 'display:none').html give you direct access to the html in question?BretOn 6/27/06, Beth Ferguson < [EMAIL PROTECTED]> wrote:I need to get information from html fields which are not displayed but are not explicityly marked hidden:such as: basefrm Application Monitoring Application Library /gateway/infrastructure/Library.do Application Groups /gateway/infrastructure/Group.do i have tried the hidden() methods but have not gotten it to work. doesanyone have suggestions?Thanks-Beth___Wtr-general mailing list Wtr-general@rubyforge.orghttp://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] parsing fields
I need to get information from html fields which are not displayed but are not explicityly marked hidden: such as: basefrm Application Monitoring Application Library /gateway/infrastructure/Library.do Application Groups /gateway/infrastructure/Group.do i have tried the hidden() methods but have not gotten it to work. does anyone have suggestions? Thanks- Beth ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Wait for control to exist
My comments below.On 6/21/06, Jonathan Ni <[EMAIL PROTECTED]> wrote: I have tried to implement this wait_until function on my own. My code handles some situation, however the most case I got an error that I don't really understand. Error message: NoMethodError: undefined method `all' for nil:NilClass C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1029/./watir.rb:984:in `ole_inner_elements' C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1029/./watir.rb:1033:in `locate_input_element' C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1029/./watir.rb:3448:in `locate' C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1029/./watir.rb:2398:in `exists?'Without even looking at the code, let me explain what this message itself means. We have some code that looks like "something.all" and the something is actually nil. Now i know that ole_inner_elements is usually implemented as document.body.all -- so that would mean that the "body" is nil. This is happen randomly at all object when the page changes. After I try to understand the reason, I found the _javascript_ rendering data has following steps. 1. load object 2. load more attributes of this object 3. load more data that this object needs. (eg. select box options)I think that you need to first call ie.wait -- this will wait for the page load, which will ensure that you have a body. If you need additional waiting after that, then use your code for that. My code 1.upto timeout do result = object(:text_field,:name,/logonId/) if result && result.respond_to?('exists?') && result.exists? return result else sleep 1 end end The error is happens at result.exists? I think this is because object(:text_field,:name,/logonId/) is return the result at (1) stage, which is load object. What this mean is the text_field tag is already been loaded, but not completely. So when the result.exists, it goes to @o = @container.locate_input_element(@how , @what, self.class::INPUT_TYPES) From here, I am lost. Could someone help me with this? Maybe my finding about _javascript_ loading object is not right. Please help me! Thanks everyone. Regards, Jonathan Ni ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Did the implementation for contains_text change?
On 6/27/06, Cain, Mark <[EMAIL PROTECTED]> wrote: I was attempting to use text.include? like: $ie.text_field(:name, "MyText").text.include? "My text to verify" And I get this message: " warning: parenthesize argument(s) for future version" Am I getting this because I am using "text.include?" incorrectly or something else?The example you provide should not give that warning. (It doesn't for me.)But if you are getting that warning in other cases, you can add parens to avoid it. In Ruby, you can always parenthesize arguments to a method. You only need to do it when there is the possibility of ambiguity. (In other words, parens in Ruby follow the same rules as in math.)Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Need specific example of how to find a control inside a SPAN with a Custom Attribute.
Here's an example. Hope this helps.# sspan is the variable to which I assigned the Span object. The span object contains the text field.sspan = $ie.span(:id, 'guaranteedSpan') sspan.text_field(:index, 1).set('165000') # the text field name is dynamic, it changes all the time. So, I used index here. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Did the implementation for contains_text change?
I was attempting to use text.include? like: $ie.text_field(:name, "MyText").text.include? “My text to verify” And I get this message: “warning: parenthesize argument(s) for future version” Am I getting this because I am using “text.include?” incorrectly or something else? Thanks, --Mark From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord Sent: Monday, June 26, 2006 3:53 PM To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] Did the implementation for contains_text change? Looks like a bug. Please go ahead and enter this in Jira. http://jira.openqa.org/browse/WTR In general, i have been thinking of deprecating contains_text and instead encouraging people to use "text.include?" (or regexps). ie.frame(:index, 2)text.include? "DimensionManager" But that's not why it's missing in 1.5. Bret On 6/23/06, George Flaherty <[EMAIL PROTECTED] > wrote: I am now on the latest watir gem (1.5.1.1037). When I had 1.4.1 installed the following functionality did work...but now I am seeing the following error? I tried both from irb and a unit test script and I got the same error message. *WATIR: 1.5.1 (1037gem) -Error irb(main):002:0> ie = Watir::IE.attach(:title, /Merch/) irb(main):003:0> ie.frame(:index, 2).contains_text('DimensionManager') NoMethodError: undefined method `contains_text' for # from (irb):3 I also just confirmed that this did work with the 1.4.1 implementation: WATIR: 1.4.1 (single click) - Working irb(main):004:0> ie = Watir::IE.attach(:title, /Merch/) irb(main):006:0> ie.frame(:index,2).contains_text('DimensionManager') => nil irb(main):007:0> Thanks -george ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] FireWatir on Intel Mac
On 6/27/06, Chris McMahon <[EMAIL PROTECTED]> wrote: If I'm not mistaken, it's because the build depends on C:\ruby\lib\ruby\gems\1.8\gems\watir-1.5.0.945\watir\win32ole\win32ole.so and this was not interpreted correctly on the Mac? That is, there is no context for win32ole on platforms other than Windows? More or less. I got firewatir working on my Mac Book Pro a little while ago, and found the performance too lacking to do much more with it. Attached is a patch to firewatir's watir.rb that allowed me to get it working (for educational purposes only). I had to comment out things like winClicker etc. I suppose these could be conditionally included. What's the latest on firewatir? Are there plans to merge it back into the main watir codebase? Is jssh the long-term plan for integrating watir into firefox? This is definitely something I'd like to jump in and help hack on. From my perspective I'd like to make some fairly sweeping changes to the code, particularly the global variable for the jssh socket and hard-coded javascript in each method, but I don't want to interfere with anyone else if they're currently working on it. If someone could inform me of the plans for the firewatir code, that would be great. Cheers, /Nick firewatir-mac.patch Description: Binary data ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] FireWatir on Intel Mac
> > and Chris McMahon was able to get me the latest > > Watir source built into a gem (can't do that w/o Windows currently), > > > Do we need to make a FireWatir gem publicly available? > > I'm also curious about why you can't create a gem on non-windows platforms. > Sounds like a bug we should fix. If I'm not mistaken, it's because the build depends on C:\ruby\lib\ruby\gems\1.8\gems\watir-1.5.0.945\watir\win32ole\win32ole.so and this was not interpreted correctly on the Mac? That is, there is no context for win32ole on platforms other than Windows? -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] FireWatir on Intel Mac
Dave,Thanks for the report and suggestions.On 6/27/06, Dave Hoover <[EMAIL PROTECTED]> wrote: and Chris McMahon was able to get me the latestWatir source built into a gem (can't do that w/o Windows currently), Do we need to make a FireWatir gem publicly available?I'm also curious about why you can't create a gem on non-windows platforms. Sounds like a bug we should fix. and then I had to comment out any win32 stuff that Watir does when itis require'd, and voila, FireWatir on the Mac. This sounds like another bug. Do we have any one interested in following up on Dave's suggestions? Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] FireWatir on Intel Mac
I gave a talk on Acceptance Testing at RailsConf yesterday, showcasing Watir, Selenium, and Sahi. Since I have a MacBook Pro (and I hadn't installed Parallels/WinXP yet), I wanted to show off FireWatir. Alas, it appears that the JSSH XPI that FireWatir relies upon doesn't work on Mac Firefox. Dave Liebreich from Mozilla was able to get me a Firefox + JSSH build and Chris McMahon was able to get me the latest Watir source built into a gem (can't do that w/o Windows currently), and then I had to comment out any win32 stuff that Watir does when it is require'd, and voila, FireWatir on the Mac. It still suffers from insanely slow performace, but it's a start. Dave is still working on getting the JSSH XPI for the Mac working, but until then, he has graciously hosted an Intel-only Firefox+JSSH binary here: http://people.mozilla.org/~davel/jssh/ More info here: http://www.daveliebreich.com/blog/?page_id=6 Once he gets the XPI working, he will likely take down the Firefox binary. Thank you everyone working on (Fire)Watir, it's a great tool, and I hope that more work can be done to bring it onto the other browsers. Dave Hoover http://redsquirrel.com/dave/ ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Issue with gem 1.5.11037
Thanks Bret. I always do 'require "watir"' but "false" as a response got me puzzled. I read somewhere (at this list possibly) that I should try 'require "Watir"' so I tried that too, and than got all that warnings. On 6/27/06, Bret Pettichord <[EMAIL PROTECTED]> wrote: And you really shouldn't be doing 'require "Watir"' in the first > place. > > Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Issue with gem 1.5.11037
On 6/27/06, Zeljko Filipin <[EMAIL PROTECTED]> wrote: The funny thing is that I get "false" after I type 'require "watir"'.It should be "true", right? And, watir works, as if I did not get"false".irb(main):001:0> require "watir" => falseYou get false if it is loaded as a gem. True if the file is in your $LOAD_PATH. Most people seem to think this is a bug in ruby gem software. The other thing, I get that warning messages even if I do not type'require "watir"' before 'require "Watir"'. And, of course, watirworks that way too.I can explain this. First of all, you have to understand that if you do require 'watir'and require './watir'You'll get the same warning messages. This is because the library is loaded twice. And this is because the library is associated literally with how it was required. Require it using a slightly different path that resolves to the same file, it is loaded again. And you see that the same thing happens if you do require 'watir'and require 'Watir'for the same reasons.OK?So why does require 'Watir' itself also cause the watir library to be loaded twice? My guess is that watir.rb itself requires files that in turn "require 'watir'" -- this gives you your second require name. There are a number of related libraries in watir, and normally these kinds of circular references are harmless. Actually, even in this case, they still are. It's just a warning. And you really shouldn't be doing 'require "Watir"' in the first place.Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Issue with gem 1.5.11037
David, thanks for the reply, but my post was not clear. The funny thing is that I get "false" after I type 'require "watir"'. It should be "true", right? And, watir works, as if I did not get "false". irb(main):001:0> require "watir" => false The other thing, I get that warning messages even if I do not type 'require "watir"' before 'require "Watir"'. And, of course, watir works that way too. Take a look. C:\Documents and Settings\zfilipin\Desktop>irb irb(main):001:0> require "Watir" c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./Watir.rb:1039: warning: already initialized constant REVISION c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./Watir.rb:1042: warning: already initialized constant VERSION c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./Watir.rb:1045: warning: already initialized constant READYSTATE_COMPLETE c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./Watir.rb:1048: warning: already initialized constant DEFAULT_TYPING_SPEED c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./Watir.rb:1051: warning: already initialized constant DEFAULT_SLEEP_TIME c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./Watir.rb:1054: warning: already initialized constant DEFAULT_HIGHLIGHT_COLOR c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./Watir.rb:1901: warning: already initialized constant TO_S_SIZE c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./Watir.rb:2217: warning: already initialized constant TAG c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./Watir.rb:2225: warning: already initialized constant TAG c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./Watir.rb:2232: warning: already initialized constant TAG => true irb(main):002:0> ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general