[Wtr-general] How to output brief/detail information when do logging
Dear all, I use C:\watir1145\examples\logging\example_logger1.rb to do logging, it will output the same message both into the console and log file. Now, I want it output brief message on the console while detail message in the log file, in other words, the run result for each test case on the console and trace/debug information for every step in the log file, is there an switch parameter in it can achieve it? Or is there any ruby class/script/project which can conveniently solve this problem? Regards, Jason example_logger1.rb Description: example_logger1.rb test_logger1.rb Description: test_logger1.rb ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Testing a development process
Help, I've introduced Watir to a small software house i'm contracted with and now they love it so much, they want to get rid of me and include watir scripts in their build process. The CTO's comments are Thank you for introducing us to Watir, WatirN, Goodbye. How can I convince them that they need a tester to write Watir, Watin scripts to ensure an independant eye and approach to testing. What are your suggestions -- The time to stop talking is when the other person nods his head affirmatively but says nothing. - Henry S. Haskins ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] using span
Hi all, I have a span link in which if we mouse hover on that link a form appears for us.It will be there still we cancel that form, And it does not work on click, So is there a way to automate that link using watir?? I used $ie.span(:class,popup_link).click but it doesn't open the form, but i tried mouse hover manually while watir is running then watir recognized the form, so can u please help me to open the form using the mouse hover? Thanks in Advance, Harish ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to output brief/detail information when do logging
Hi Jason, You can look into Log4r library. http://log4r.sourceforge.net/ Regards, Prema On 3/16/07, Jason He [EMAIL PROTECTED] wrote: Dear all, I use C:\watir1145\examples\logging\example_logger1.rb to do logging, it will output the same message both into the console and log file. Now, I want it output brief message on the console while detail message in the log file, in other words, the run result for each test case on the console and trace/debug information for every step in the log file, is there an switch parameter in it can achieve it? Or is there any ruby class/script/project which can conveniently solve this problem? Regards, Jason ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general -- Prema Arya ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Unable to load watir/contrib/enabled_popup
I had Watir 1.4 and I downloaded and installed Watir 1.5 and now it works. Thanks for the suggestion. Message was edited by: jarkelen1 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Click on button which isn't a button
Hi, In our website we have buttons which are actually div's but without any id or name. The html code looks like this: table class=p-button cellspacing=0 tr td onclick=window.location.href='registration.jsp divRegister now/div /td /tr /table How can I click on such a button? The ie.div(:index, 7).click method doesn't work. Thanks! ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Click on button which isn't a button
This worked for me (watir 1.5.1.1158). ie.div(:text, Register now).click -- ZeljkoFilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] 'getObject' command
There is one object in browser page. Can I use the command 'getObject(how, what, types, value=nil)' to recognize that object. How we can implement this. mjk Yahoo India, EGL, Bangalore - 71, Phone:+91-80-30516346, Mobile:+91-9945849925 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Calculating attachment uploading time
Capture Timings section at http://en.wikipedia.org/wiki/Watir -- ZeljkoFilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] 'getObject' command
Hi, Can you be more specific like what kind of object is it? Whats the HTML of the page? etc etc. The information you provided is not sufficient enough for anyone to be able to help you. Regards, Angrez On 3/16/07, Mathew Jacob [EMAIL PROTECTED] wrote: There is one object in browser page. Can I use the command 'getObject(how, what, types, value=nil)' to recognize that object. How we can implement this. mjk * * *Ya**ho**o India, EGL, Bangalore – 71, Phone:+91-80-30516346, Mobile:+91-9945849925* ___ 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] Click on button which isn't a button
This works, thanks! But I have a complication: our site has multiple languages and we want to be able to run the tests on all languages. Therefore I can't use the text property, because this will be different in another languag than English. Of course I can use ie.form(:name, retailLocation).submit instead, but this way I bypass the button and won't notice it when the button itself is not working. I would like to click on the div element based on index, but this doesn't seem to work? ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Click on button which isn't a button
Yep - I just got a new mockup for one of our upcoming sites that uses divs in the same way, and I used the div-click just like Zeljko shows when the index method doesn't seem to find them. However, if you're experimenting and driving around the website for a while using IRB, sometimes IRB seems to quit for me. I could specify divs that I knew existed and had previously clicked on, and they would not activate or give me an error - they'd just hang out instead. I exited IRB and started it right back up again, and they worked flawlessly. I'm not sure how common this is, but you might want to try it out. Thanks, Adam From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Željko Filipin Sent: Friday, March 16, 2007 5:49 AM To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] Click on button which isn't a button This worked for me (watir 1.5.1.1158). ie.div(:text, Register now).click -- ZeljkoFilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Click on button which isn't a button
If language changes I would recommend that you ask your developer to add an id attribute to div tag. Then you would not have to rely on text. If that is not the option, you can try this. ie.cell(:html, /registration/).click or ie.cell(:html, /registration/).div(:text, //).click -- ZeljkoFilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Calculating attachment uploading time
I wrote this to get page loads times but you should be able to use it to accomplish what you are asking. require 'date' $start = DateTime.now # process you want to time here... $stop = DateTime.now diff = $stop - $start h,m,s,frac = Date.day_fraction_to_time(diff) s += frac.to_f File.open('C:\watir_bonus\working\pageSearchLoad_Times.txt', 'a+'){|d| d.puts Time to load page: + #{h} Hours, #{m} Minutes, #{s} Seconds} Hope this helps, --Mark From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mathew Jacob Sent: Friday, March 16, 2007 5:32 AM To: wtr-general@rubyforge.org Cc: [EMAIL PROTECTED] Subject: [Wtr-general] Calculating attachment uploading time I want to calculate the attachment uploading time in one mail client. How can I calculate this time. Help me in this scenario ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Testing a development process
This is a great question and a tough one too. One of my philosophies during my career has always been to make myself replaceable so that I can move onto other more interesting things. In your situation, it sounds like you've accomplished that. You introduced a tool and a desire to move testing back towards the development staff. That's a great success, isn't it? That aside, I work in a small agile development shop and my boss understands the value provided by having independent software testers on the RD team. Using a scripting tool to assist in the testing effort is not the same as automating testing. I don't believe that you can automate the complexity involved in real Testing. (And not in the foreseeable future either.) So the question I would pose back to you is this: can you articulate to the CTO what the difference is between testing software and computer assisted testing (i.e. otherwise called 'test automation')? Hint: the value you provide is not in the scripting. If your CTO can't understand that, then you might be better off looking for a new contract elsewhere anyway. Best wishes! Cheers. Paul C. On 16/03/07, Tunde Jinadu [EMAIL PROTECTED] wrote: Help, I've introduced Watir to a small software house i'm contracted with and now they love it so much, they want to get rid of me and include watir scripts in their build process. The CTO's comments are Thank you for introducing us to Watir, WatirN, Goodbye. How can I convince them that they need a tester to write Watir, Watin scripts to ensure an independant eye and approach to testing. What are your suggestions ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Click on button which isn't a button
This brings up an interesting issue that came up yesterday. We have a new front-end designer on staff who was creating some mockups for a new project. I was getting familiar with his code and using watir to navigate around, and noticed that of the ~90 divs on the page, only 5-6 have unique (or any) id tags. These unnamed divs make up the primary navigation system for the site. There are no images, buttons or tables on the page. So of course, not thinking much into it - I ask if it would be possible for him add unique id tags to the major navigational elements (50% of the divs are not important to anything other than design). He replied, saying that adding unique ids to all elements would wreak havoc with style sheets, since all of these unnamed divs share the same style information. Also, for Search Engine Optimization (SEO), he needs to keep as much unnecessary text off the page as possible (although this point is debatable). In this case, where do we go from here? I completely understand his point, but at the same time I would be prevented from automating the majority of the tests on the new site. Of course we don't rely 100% on automation (probably less than 50%), but 100% manual testing requires quite more time, and produces many fewer test results. I'd be interested to hear solutions, or just comments on the issue - I know it has to be fairly common. -- Adam From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Željko Filipin Sent: Friday, March 16, 2007 8:38 AM To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] Click on button which isn't a button If language changes I would recommend that you ask your developer to add an id attribute to div tag. Then you would not have to rely on text. If that is not the option, you can try this. ie.cell(:html, /registration/).click or ie.cell(:html, /registration/).div(:text, //).click -- ZeljkoFilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Testing a development process
It is time to find a new client. If you are right, with time they will figure out on their own why they need you and will be calling you back. Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] using span
If it has a javascript onmouseover event associated with it, you could fire that event first and then get the controls. ie.span(:class, 'popup_link').fire_event('onmouseover') now interact with the controls on the rendered form. Hopefully that helps. -Charley On 3/16/07, Naga Harish Kanegolla [EMAIL PROTECTED] wrote: Hi all, I have a span link in which if we mouse hover on that link a form appears for us.It will be there still we cancel that form, And it does not work on click, So is there a way to automate that link using watir?? I used $ie.span(:class,popup_link).click but it doesn't open the form, but i tried mouse hover manually while watir is running then watir recognized the form, so can u please help me to open the form using the mouse hover? Thanks in Advance, Harish ___ 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] Click on button which isn't a button
Hi Adam, this is the situation we have with our navigation bar for one of our web apps. Using Watir 1.4.1 I couldn't use the 'text' attribute for SPAN tags and none of the Spans had unique ID's. What I ended up doing was creating two methods to help us navigate the system. The first one is called 'populate_navigation_bar' and the second is navigate_bar(). In the first method, I iterate through all the Div and Span tags with the desired information and put them into a Hash array. The 'values' are the index numbers. Then when I want to navigate through the system, I call the navigate_bar() method and pass it the name I want and the method clicks the corresponding element using the index number. This gives me a certain amount of flexibility in my tests because I can now select random elements really easily for each test run, navigate to the 'top' of the list regardless of whatever it's called, and other cool things like that. In Watir 1.5.x, I can now use the 'text' attribute for Spans, but I decided to keep navigating the system the same way because I have greater control this way. That's how I deal with the problem anyway. Maybe this might work for you? Good luck! Cheers. Paul C. On 16/03/07, Adam Reed wrote: This brings up an interesting issue that came up yesterday. We have a new front-end designer on staff who was creating some mockups for a new project. I was getting familiar with his code and using watir to navigate around, and noticed that of the ~90 divs on the page, only 5-6 have unique (or any) id tags. These unnamed divs make up the primary navigation system for the site. There are no images, buttons or tables on the page. So of course, not thinking much into it - I ask if it would be possible for him add unique id tags to the major navigational elements (50% of the divs are not important to anything other than design). He replied, saying that adding unique ids to all elements would wreak havoc with style sheets, since all of these unnamed divs share the same style information. Also, for Search Engine Optimization (SEO), he needs to keep as much unnecessary text off the page as possible (although this point is debatable). In this case, where do we go from here? I completely understand his point, but at the same time I would be prevented from automating the majority of the tests on the new site. Of course we don't rely 100% on automation (probably less than 50%), but 100% manual testing requires quite more time, and produces many fewer test results. I'd be interested to hear solutions, or just comments on the issue - I know it has to be fairly common. -- Adam ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Click on button which isn't a button
Thanks for the help Paul. I did have one question about this method, however: As far as putting indexes and the name you want in the Hash array, does this assume that the indexes of certain elements are constant through the website? The reason that I didn't use index navigation inititally was because as each div is clicked and activated, the div indexes around the page appear to change. While at first the Home div is #7, after being clicked it becomes #9. Would this throw a wrench in the gears of your script? There's a very good chance I've just missed the point, but that's how I understand it so far. Thanks again, Adam From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Carvalho Sent: Friday, March 16, 2007 3:23 PM To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] Click on button which isn't a button Hi Adam, this is the situation we have with our navigation bar for one of our web apps. Using Watir 1.4.1 I couldn't use the 'text' attribute for SPAN tags and none of the Spans had unique ID's. What I ended up doing was creating two methods to help us navigate the system. The first one is called 'populate_navigation_bar' and the second is navigate_bar(). In the first method, I iterate through all the Div and Span tags with the desired information and put them into a Hash array. The 'values' are the index numbers. Then when I want to navigate through the system, I call the navigate_bar() method and pass it the name I want and the method clicks the corresponding element using the index number. This gives me a certain amount of flexibility in my tests because I can now select random elements really easily for each test run, navigate to the 'top' of the list regardless of whatever it's called, and other cool things like that. In Watir 1.5.x, I can now use the 'text' attribute for Spans, but I decided to keep navigating the system the same way because I have greater control this way. That's how I deal with the problem anyway. Maybe this might work for you? Good luck! Cheers. Paul C. On 16/03/07, Adam Reed wrote: This brings up an interesting issue that came up yesterday. We have a new front-end designer on staff who was creating some mockups for a new project. I was getting familiar with his code and using watir to navigate around, and noticed that of the ~90 divs on the page, only 5-6 have unique (or any) id tags. These unnamed divs make up the primary navigation system for the site. There are no images, buttons or tables on the page. So of course, not thinking much into it - I ask if it would be possible for him add unique id tags to the major navigational elements (50% of the divs are not important to anything other than design). He replied, saying that adding unique ids to all elements would wreak havoc with style sheets, since all of these unnamed divs share the same style information. Also, for Search Engine Optimization (SEO), he needs to keep as much unnecessary text off the page as possible (although this point is debatable). In this case, where do we go from here? I completely understand his point, but at the same time I would be prevented from automating the majority of the tests on the new site. Of course we don't rely 100% on automation (probably less than 50%), but 100% manual testing requires quite more time, and produces many fewer test results. I'd be interested to hear solutions, or just comments on the issue - I know it has to be fairly common. -- Adam ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Tables nested in a div
John, I believe the .tables method returns an array of all the tables within div, so .tables[0] will return the first table in the div. Try: mainFrame.div(:id, menuId).tables[1].click Ethan On 3/15/07, John Lloyd-Jones [EMAIL PROTECTED] wrote: I have a tricky page where I need to click on a a menu that has been implemented as a table. There are many such menus and I can find the surrounding div (by id), but there is no other way to find the table (it doesn't have a predictable index, for example). So what I want is to ask the Div for the table -- where it is in fact, the only nested table). E.g. menu = mainFrame.div(:id, menuId) menuTable = menu.table(:index, 1) menuTable[ 4 ][ 1 ].click Alas, this doesn't work out of the box -- Watir assumes that you always want to find tables nested in the document, so it errors out on menu.table() saying that there is no document. As tables are commonly nested in divs, and as far as I can see, adding a table method to the Div class wouldn't break any current code, is there any reason why Div couldn't do something like this? class Watir::Div def table( how, what ) if how == :index @o.getElementsByTagName( 'table' )[what.to_s] Table.new(@ieController, :from_object, table) else super.table( how, what ) end end end The table method overrides the super class for :index, but not for :id (which should be unique, so it doesn't need special handling). It certainly does make the code snipped abpve work. I haven't done any exhaustive tests to see if it breaks anything, but I can't think of any scenario where it could. John ___ 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] Click on button which isn't a button
there is a trick you can use when using stylesheets and id tags ( i forget exactly what/why) , but there are definitely other ways and probably better ways to do it. How much time will it take for him to change the divs to use class='some_css_clss' and ad ids, compared to you finding a way round this? My guess is its going to be better for everyone if he does it correctly. Can he put names on instead? How about a custom attribute ( div id=css_hack tester_thing=id1 ) and then you do a quick hack in wastir to use testter_thing as an attribute ( thats actually pretty easy I think ) Some on the thread mentioned multi-lingual problems so they couldnt use :text - heres how I fixed that. I already had hundreds of elements coded, so couldnt afford the time to go back and change them all $lang = :french ie.div(:text , 'Click Me') .click We overrode the various watir methods- to check the $lang if its not set it uses english, otherwise it uses the specified language. Then looks up in an array ( or xml, or yaml, or whatever) and finds the english ( in this case CLick Me ) It then looks for the equivalent in the supplied language.. This way your script is still readable in English. Im sure its not the best way, but as we had lots of code already it seemed like the best way - Original Message - From: Adam Reed To: wtr-general@rubyforge.org Sent: Friday, March 16, 2007 8:32 AM Subject: Re: [Wtr-general] Click on button which isn't a button This brings up an interesting issue that came up yesterday. We have a new front-end designer on staff who was creating some mockups for a new project. I was getting familiar with his code and using watir to navigate around, and noticed that of the ~90 divs on the page, only 5-6 have unique (or any) id tags. These unnamed divs make up the primary navigation system for the site. There are no images, buttons or tables on the page. So of course, not thinking much into it - I ask if it would be possible for him add unique id tags to the major navigational elements (50% of the divs are not important to anything other than design). He replied, saying that adding unique ids to all elements would wreak havoc with style sheets, since all of these unnamed divs share the same style information. Also, for Search Engine Optimization (SEO), he needs to keep as much unnecessary text off the page as possible (although this point is debatable). In this case, where do we go from here? I completely understand his point, but at the same time I would be prevented from automating the majority of the tests on the new site. Of course we don't rely 100% on automation (probably less than 50%), but 100% manual testing requires quite more time, and produces many fewer test results. I'd be interested to hear solutions, or just comments on the issue - I know it has to be fairly common. -- Adam -- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Željko Filipin Sent: Friday, March 16, 2007 8:38 AM To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] Click on button which isn't a button If language changes I would recommend that you ask your developer to add an id attribute to div tag. Then you would not have to rely on text. If that is not the option, you can try this. ie.cell(:html, /registration/).click or ie.cell(:html, /registration/).div(:text, //).click -- ZeljkoFilipin.com -- ___ 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] Click on button which isn't a button
Heh. You didn't miss the point. That's why populate_navigation_bar is a method! ;-) Cheers! Paul C. On 16/03/07, Adam Reed [EMAIL PROTECTED] wrote: Thanks for the help Paul. I did have one question about this method, however: As far as putting indexes and the name you want in the Hash array, does this assume that the indexes of certain elements are constant through the website? The reason that I didn't use index navigation inititally was because as each div is clicked and activated, the div indexes around the page appear to change. While at first the Home div is #7, after being clicked it becomes #9. Would this throw a wrench in the gears of your script? There's a very good chance I've just missed the point, but that's how I understand it so far. Thanks again, Adam ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general