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