Hi Suman, Can you try the following?
Simulate pressing {TAB} key until you get focus on the textarea i.e. send or
Press {TAB} key using code. First count the number of tabs required by doing
the same in UI and send that many tab key events, to get focus on the text
area. Once you get the focus you can access text area using normal watir
statements like
$ie.text_field(:id, 'some_id').value = 'some value'
Let me know if this works.
- Angrez
On 1/30/07, Suman Goel <[EMAIL PROTECTED]> wrote:
Also, firefox, web developer tool's display form details feature shows me the following for the required fields: ------------------------------ *From:* [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] *On Behalf Of *Suman Goel *Sent:* Monday, January 29, 2007 10:27 PM *To:* [email protected] *Subject:* Re: [Wtr-general] how to populate hidden text area? I forgot to mention in my previous email that on irb, this solution is working as displayed below. But in IE, it does not since the text field is a required field and expecting a value at the time of clicking the submit button. I need some way to overlook that required flag of the field. Thanks ------------------------------ *From:* [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] *On Behalf Of *Paul Rogers *Sent:* Monday, January 29, 2007 8:04 PM *To:* [email protected] *Subject:* Re: [Wtr-general] how to populate hidden text area? It seems to work fine for me: irb(main):017:0> puts ie.text_field(:id , /h/).value abc => nil irb(main):018:0> ie.text_field(:id , /h/).set('gg') WIN32OLERuntimeError: focus OLE error code:800A083E in htmlfile Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus. HRESULT error code:0x80020009 Exception occurred. from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1145/./watir.rb:3888:in `method_missing' from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1145/./watir.rb:3888:in `set' from (irb):18 irb(main):019:0> ie.text_field(:id , /h/).value='fg' => "fg" irb(main):020:0> puts ie.text_field(:id , /h/).value fg => nil irb(main):021:0> Watir::IE::VERSION => "1.5.1.1145" irb(main):022:0> ----- Original Message ----- *From:* Paul Rogers <[EMAIL PROTECTED]> *To:* [email protected] *Sent:* Monday, January 29, 2007 8:40 PM *Subject:* Re: [Wtr-general] how to populate hidden text area? can you elaborate on that? ----- Original Message ----- *From:* Suman Goel <[EMAIL PROTECTED]> *To:* [email protected] *Sent:* Monday, January 29, 2007 5:08 PM *Subject:* Re: [Wtr-general] how to populate hidden text area? Yes. I did what you wrote below and it did not work -Suman ------------------------------ *From:* [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] *On Behalf Of *Paul Rogers *Sent:* Sunday, January 28, 2007 3:56 PM *To:* [email protected] *Subject:* Re: [Wtr-general] how to populate hidden text area? presumably you tried @ie.text_field(:name, 'J_LDESC').value='yes' and that didnt work? ----- Original Message ----- *From:* Suman Goel <[EMAIL PROTECTED]> *To:* [email protected] *Sent:* Friday, January 26, 2007 3:54 PM *Subject:* [Wtr-general] how to populate hidden text area? This did not work for me as my webpage has J__LDESC(the textarea in question) as the required field and so, on clicking submit button, I get the error message to fill in the field. Any other suggestions? Suman try using the value method: @ie.text_field(:name, ..).value='some text' the set method fires all appropriate evens, and generally obeys what the web page is doing ( ie not letting you enter something that is hidden) but value= will get round that Paul ----- Original Message ----- From: Suman Goel To: wtr-general at rubyforge.org <http://rubyforge.org/mailman/listinfo/wtr-general> Sent: Thursday, January 25, 2007 10:17 PM Subject: [Wtr-general] how to populate hidden text area? My webpage has the following code: <textarea name="J__LDESC" style="visibility:hidden">(NULL)</textarea> My watir test has the following code: @ie.text_field(:name, "J__LDESC").set("some text") I am getting the following error: 1) Error: test_MemSlot(TestMemSlot): WIN32OLERuntimeError: focus OLE error code:800A083E in htmlfile Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus. HRESULT error code:0x80020009 Exception occurred. C:/ruby1.8.5/ruby/lib/ruby/site_ruby/1.8/watir.rb:3399:in `method_missing' C:/ruby1.8.5/ruby/lib/ruby/site_ruby/1.8/watir.rb:3399:in `set' C:/workspace/yhj_slot/test/tc_MemSlot.rb:43:in `test_MemSlot' Could someone help me in resolving this issue? Thanks ------------------------------ _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general ------------------------------ _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general ------------------------------ _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
<<attachment: image001.jpg>>
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
