[wtr-general] Upgrading anxiety
We have Watir 1.6.2 and Ruby 1.8.6. We have MANY Watir/Test/Unit scripts which we (well, I) mainly use to help with exploratory testing, and to verify releases. I can't live without these scripts, so I don't want to break them. At the same time, I want to try the latest Watir and Webdriver to see if it correctly interprets the JS that our new Dojo code has - the version of Watir we have can't cope with it, and Canoo WebTest/HtmlUnit also cannot correctly interpret it. I perused the latest install instructions and info about the later Watir releases, and it sounds like our older Watir scripts aren't going to work with the later version? Is this true? How much effort is required to fix them? Is there a central location with this information that I just haven't found yet? If I install the latest Ruby and Watir/WebDriver, and our scripts don't work, can I back up to the old versions again? I only spend about 10% of my time doing any sort of coding, so though this might all be really obvious to y'all, it is something quite challenging and scary for me. I would hate to abandon Watir and the excellent scripts we have, but I don't get any support from my team on this. They are keen to try Selenium. Thanks, Lisa -- Lisa Crispin Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers and Agile Teams_ (Addison-Wesley 2009) Contributor to _Beautiful Testing_ (O'Reilly 2009) http://lisacrispin.com @lisacrispin on Twitter http://entaggle.com/lisacrispin -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Entering text on a read only textfield.
Hi, Earlier I use Watir unit test frawework and I can enter values in readonly textfield using “.value” method : $ie.text_field(:id, 'targetSSRepsSelected').value=”some value” I upgraded to Watir Webdriver. Now same code fails with error “ReadOnlyException”. Source Code from browser[IE] is : INPUT id=targetSSRepsSelected style=WIDTH: 300px readOnly onchange= name=targetSSRepsSelected When im using watir earlier, I can enter value on this read only textfield, but with webdriver it fails, so what shd I use to enter values now? Any help is appreciated. Thanks Bhavesh -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Upgrading anxiety
Pure and simple, try it out. Get a box that can run the latest code, and run it there. There's a problem, if you don't update production code and also test code to the latest version when they come out. I've seen this happen over and over again where no one is ready for the latest versions, and they're two, three or 8 years behind. This is an issue that you need to resolve and understand as part of the stories, there has to be a ci environment and team trying the latest code. That should be the same for production code and anything related to it, I'd posit that test code *is* the same asset. Cheers, Charley On Thu, Dec 29, 2011 at 3:34 PM, Lisa Crispin lisa.cris...@gmail.comwrote: We have Watir 1.6.2 and Ruby 1.8.6. We have MANY Watir/Test/Unit scripts which we (well, I) mainly use to help with exploratory testing, and to verify releases. I can't live without these scripts, so I don't want to break them. At the same time, I want to try the latest Watir and Webdriver to see if it correctly interprets the JS that our new Dojo code has - the version of Watir we have can't cope with it, and Canoo WebTest/HtmlUnit also cannot correctly interpret it. I perused the latest install instructions and info about the later Watir releases, and it sounds like our older Watir scripts aren't going to work with the later version? Is this true? How much effort is required to fix them? Is there a central location with this information that I just haven't found yet? If I install the latest Ruby and Watir/WebDriver, and our scripts don't work, can I back up to the old versions again? I only spend about 10% of my time doing any sort of coding, so though this might all be really obvious to y'all, it is something quite challenging and scary for me. I would hate to abandon Watir and the excellent scripts we have, but I don't get any support from my team on this. They are keen to try Selenium. Thanks, Lisa -- Lisa Crispin Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers and Agile Teams_ (Addison-Wesley 2009) Contributor to _Beautiful Testing_ (O'Reilly 2009) http://lisacrispin.com @lisacrispin on Twitter http://entaggle.com/lisacrispin -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Upgrading anxiety
I've been playing with watir-webdriver. So far, I'm liking it but one thing that drove me a little batty was the behavior described here: http://watirmelon.com/2011/08/02/watir-webdriver-obselete-element-error/ And it does use 0-based indexing, which is a change from 1.6.2. I think the newer, non-webdriver versions of Watir also do 0-based indexing. From what I've seen so far it's pretty stable and it doesn't appear to have any problems with any of the pages I've been experimenting with. Is your team eager to try the older selenium or the new webdriver version? One possible argument for selenium-webdriver over the old selenium API is that the webdriver version of selenium supports multiple element selectors (e.g., :class='foo', :index=3). I don't think the old selenium API does that and am guessing that this is why xpath is so popular in the selenium world. If I had to use selenium I'd choose the webdriver API over the old API for that alone. And I think that the watir API has advantages over the selenium-webdriver API. Two things that struck me (please, someone correct me if I'm getting any of this wrong as I'm still in the process of comparison shopping and haven't done a lot with selenium): -The selenium-webdriver API doesn't seem to support getting collections and doing something with them (e.g., browser.tables.each...). -The selenium-webdriver API doesn't seem to support daisy-chaining elements. I don't think you can do something like browser.div(:class='foo', :id='bar').text_field(:id, 'baz').text. I've spent some time recently looking at the webdriver stuff and trying to figure out what the tradeoffs are. The new selenium API does seem a lot better than the older one. From: Lisa Crispin lisa.cris...@gmail.com To: watir-general@googlegroups.com Sent: Thursday, December 29, 2011 2:34 PM Subject: [wtr-general] Upgrading anxiety We have Watir 1.6.2 and Ruby 1.8.6. We have MANY Watir/Test/Unit scripts which we (well, I) mainly use to help with exploratory testing, and to verify releases. I can't live without these scripts, so I don't want to break them. At the same time, I want to try the latest Watir and Webdriver to see if it correctly interprets the JS that our new Dojo code has - the version of Watir we have can't cope with it, and Canoo WebTest/HtmlUnit also cannot correctly interpret it. I perused the latest install instructions and info about the later Watir releases, and it sounds like our older Watir scripts aren't going to work with the later version? Is this true? How much effort is required to fix them? Is there a central location with this information that I just haven't found yet? If I install the latest Ruby and Watir/WebDriver, and our scripts don't work, can I back up to the old versions again? I only spend about 10% of my time doing any sort of coding, so though this might all be really obvious to y'all, it is something quite challenging and scary for me. I would hate to abandon Watir and the excellent scripts we have, but I don't get any support from my team on this. They are keen to try Selenium. Thanks, Lisa -- Lisa Crispin Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers and Agile Teams_ (Addison-Wesley 2009) Contributor to _Beautiful Testing_ (O'Reilly 2009) http://lisacrispin.com @lisacrispin on Twitter http://entaggle.com/lisacrispin -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Entering text on a read only textfield.
Over time Watir and Watir-webdriver have become more stringent about not letting you do something that a real human user could not do. This is because in large part watir is designed to drive the browser like a user would, in that respect it makes little sense to allow you to do something a user could not. In fact this can (and has) lead to automation that missed bugs because it was manipulating fields not accessible to the user. You can read more about this setting (readonly) here http://www.w3schools.com/tags/att_input_readonly.asp I'll quote a bit for reference as what they have to say is fairly important: =-=-=-=-=-=-= Definition and Usage The readonly attribute specifies that an input field should be read- only. A read-only field cannot be modified. However, a user can tab to it, highlight it, and copy the text from it. The readonly attribute can be set to keep a user from changing the value until some other condition has been met (like selecting a checkbox, etc.). Then, a JavaScript is required to remove the readonly value, and make the input field editable. =-=-=-=-=-=-= In your case, if a user can enter a value in that field, then there is very likely some action such as focus, altering another field, ticking a checkbox etc which causes client side code to 'flip' the field from read-only to allow the user to interact with it. You would need to figure out what that action is, and simulate it in the scripts immediately before trying to interact with the field. If you are already doing that, you may need to insert a brief pause to allow the client side code to do it's thing before attempting to interact with the field.Seeing more of the HTML is likely critical if we're to assist you with that. If you need help with that, I'd suggest posting a question to stack overflow and putting the Watir-webdriver tag on it. SO allows better embedding of HTML and Code in questions and answers (as well as editing of questions and answers) and so is superior to an email format for dealing with support questions where code is involved. One other minor point, Watir is not a unit test framework, it's function is a 'browser driver' allowing you to automate the browser. It's fine to use it for unit tests if you want, but in that case you may want to use a headless mode (or something like capybara instead) as it tends to run a lot faster, and speed is generally very important for unit tests. Most of us that do automation in Watir do it for more functional and acceptance level tests were it is critical we can drive real browsers to ensure that the sites work as intended (usually on a variety of browsers). On Dec 29, 2:36 pm, Bhavesh bhavesh1_sha...@yahoo.com wrote: Hi, Earlier I use Watir unit test frawework and I can enter values in readonly textfield using “.value” method : $ie.text_field(:id, 'targetSSRepsSelected').value=”some value” I upgraded to Watir Webdriver. Now same code fails with error “ReadOnlyException”. Source Code from browser[IE] is : INPUT id=targetSSRepsSelected style=WIDTH: 300px readOnly onchange= name=targetSSRepsSelected When im using watir earlier, I can enter value on this read only textfield, but with webdriver it fails, so what shd I use to enter values now? Any help is appreciated. Thanks Bhavesh -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Upgrading anxiety
I think the only way you will now what the actual pain to upgrade to the newest version is is to actually upgrade. in saying that Why not make a clone of the current repository on a different machine or a VM install ruby on that vm(other machine) and all the gems you need and let her rip then try and figure out one by one whats broken :) on the watir-webdriver/selenium-webdriver differences I kind of look at it as watir just being one level of abstraction higher you can essentially do the exact same things in both just the watir layer makes it a bit easier and cleaner On Thu, Dec 29, 2011 at 4:48 PM, John Fitisoff jfitis...@yahoo.com wrote: I've been playing with watir-webdriver. So far, I'm liking it but one thing that drove me a little batty was the behavior described here: http://watirmelon.com/2011/08/02/watir-webdriver-obselete-element-error/ And it does use 0-based indexing, which is a change from 1.6.2. I think the newer, non-webdriver versions of Watir also do 0-based indexing. From what I've seen so far it's pretty stable and it doesn't appear to have any problems with any of the pages I've been experimenting with. Is your team eager to try the older selenium or the new webdriver version? One possible argument for selenium-webdriver over the old selenium API is that the webdriver version of selenium supports multiple element selectors (e.g., :class='foo', :index=3). I don't think the old selenium API does that and am guessing that this is why xpath is so popular in the selenium world. If I had to use selenium I'd choose the webdriver API over the old API for that alone. And I think that the watir API has advantages over the selenium-webdriver API. Two things that struck me (please, someone correct me if I'm getting any of this wrong as I'm still in the process of comparison shopping and haven't done a lot with selenium): -The selenium-webdriver API doesn't seem to support getting collections and doing something with them (e.g., browser.tables.each...). -The selenium-webdriver API doesn't seem to support daisy-chaining elements. I don't think you can do something like browser.div(:class='foo', :id='bar').text_field(:id, 'baz').text. I've spent some time recently looking at the webdriver stuff and trying to figure out what the tradeoffs are. The new selenium API does seem a lot better than the older one. -- *From:* Lisa Crispin lisa.cris...@gmail.com *To:* watir-general@googlegroups.com *Sent:* Thursday, December 29, 2011 2:34 PM *Subject:* [wtr-general] Upgrading anxiety We have Watir 1.6.2 and Ruby 1.8.6. We have MANY Watir/Test/Unit scripts which we (well, I) mainly use to help with exploratory testing, and to verify releases. I can't live without these scripts, so I don't want to break them. At the same time, I want to try the latest Watir and Webdriver to see if it correctly interprets the JS that our new Dojo code has - the version of Watir we have can't cope with it, and Canoo WebTest/HtmlUnit also cannot correctly interpret it. I perused the latest install instructions and info about the later Watir releases, and it sounds like our older Watir scripts aren't going to work with the later version? Is this true? How much effort is required to fix them? Is there a central location with this information that I just haven't found yet? If I install the latest Ruby and Watir/WebDriver, and our scripts don't work, can I back up to the old versions again? I only spend about 10% of my time doing any sort of coding, so though this might all be really obvious to y'all, it is something quite challenging and scary for me. I would hate to abandon Watir and the excellent scripts we have, but I don't get any support from my team on this. They are keen to try Selenium. Thanks, Lisa -- Lisa Crispin Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers and Agile Teams_ (Addison-Wesley 2009) Contributor to _Beautiful Testing_ (O'Reilly 2009) http://lisacrispin.com @lisacrispin on Twitter http://entaggle.com/lisacrispin -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Upgrading anxiety
I've been doing a bunch of this sort of work at my current job so I have the following advice. (something else I should do a blog posting about) Step zero, decide if you are going to make the scripts try to run under both the newer Watir and Watir-Webdriver, or just WW. If the former I suggest a global $webdriver variable be used to wrap some code to be disabled, or create if/else wrappings around the few things that are entirely different I'm using a YAML config file to set which driver and browser to use, etc Step 1 if running on Windows install PIK it allows you to have multiple versions of Ruby installed and each can have it's own set of gems etc. For Mac get RVM it's similar only better.This allows you to use a single machine and flip it instantly between setups Step 2 source control is your friend (you know that already I'll bet) so will be search and replace Step 3 For updating the scripts I do the following (I've made notes as I went along, this is what I found so far) part 1 the basic updates that (should) work with both Watir 2.0 and WW: a) search for any instance of :index if the value is 1, remove it entirely (that's the default if nothing is specified), if the value is 1 reduce it by one. b) Replace: $ie or $ff with $browser or just $b (depending on your preference/style) c) Replace: browser.text_contains with browser.text.include? d) Replace: text_field.verify_contains(dfadf) with text_field.text.include?(dfadf') e) Replace: select_list.includes? with select_list.include? (singular) f) Replace: :url with :href ( !! in most element 'how' but NOT for window switching see below) j) .isSet with .set? Part 2 stuff from Watir you no longer need. Some stuff you had before is not necessary in webdriver remove/comment out or disable via wrapping with unless $webdriver if trying to be compatible with both Watir and WW) a) .document (anything) b) .document.scrollintoview (is automagical in WW) Part 3 Entirely different logic. again you can either use if/else based on 'if $webdriver' or just switch from the old to the new if you don't want to be cross compatible a) Window/Browser changing stuff Watir: Watir::IE.Attach(how, what) = WW: browser.window(how,what),use Watir: browser.close = WW: browser.window.close b) Javascript popup stuff (see http://stackoverflow.com/a/8172888/409820 ) Watir: some _no_wait method followed by browser.javascript_dialog.button.click WW: wrap one of the following around the action that causes popup browser.alert do #cause of alert popup end #= the alert message browser.confirm(true) do #cause of confirm (set 'true' above to false to not confirm) end #= the confirm message browser.prompt(hello) do #cause of prompt. #replace 'hello' above with user input in response to prompt end #= { :message = foo, :default_value = bar } If you find more (or if anyone else wants to add to the list) please feel free to update this and repost. (or add to the watir wiki) On Dec 29, 2:34 pm, Lisa Crispin lisa.cris...@gmail.com wrote: We have Watir 1.6.2 and Ruby 1.8.6. We have MANY Watir/Test/Unit scripts which we (well, I) mainly use to help with exploratory testing, and to verify releases. I can't live without these scripts, so I don't want to break them. At the same time, I want to try the latest Watir and Webdriver to see if it correctly interprets the JS that our new Dojo code has - the version of Watir we have can't cope with it, and Canoo WebTest/HtmlUnit also cannot correctly interpret it. I perused the latest install instructions and info about the later Watir releases, and it sounds like our older Watir scripts aren't going to work with the later version? Is this true? How much effort is required to fix them? Is there a central location with this information that I just haven't found yet? If I install the latest Ruby and Watir/WebDriver, and our scripts don't work, can I back up to the old versions again? I only spend about 10% of my time doing any sort of coding, so though this might all be really obvious to y'all, it is something quite challenging and scary for me. I would hate to abandon Watir and the excellent scripts we have, but I don't get any support from my team on this. They are keen to try Selenium. Thanks, Lisa -- Lisa Crispin Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers and Agile Teams_ (Addison-Wesley 2009) Contributor to _Beautiful Testing_ (O'Reilly 2009)http://lisacrispin.com @lisacrispin on Twitterhttp://entaggle.com/lisacrispin -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com