in reply to To set values for a textbox in a Web application

Hi saran_techie,

I have never used this module (I tend to use Win32::IE::Mechanize when doing this kind of thing), however a quick look at the documentation makes me think that your getTable call is wrong. You have $IE->getTable('name':, '<tablename>') when the documentation suggests $IE->getTable("name:", "<tablename>"). The difference being that the colon is quoted.

This aside, are you sure you are looking to populate a table with text data, and not a text input box? Your comment preceding the getTable call, along with the actual question you have asked suggests this is the case. The setValue method "will set the value of text field or text area to the string provided".

Double check the HTML source of the page in question, find the id or the name of the text input field for the username, and try something like:

$ie->getTextBox('name:', "userid")->SetValue("marto");

This should set the value of a textbox named 'userid' the value 'marto'. Please not that this us untested, I don't have a windows box handy at the moment.

As a side note, having use strict; and use warnigns; is missing from your code also :)

Hope this helps

Martin

Replies are listed 'Best First'.
Re^2: To set values for a textbox in a Web application
by saran_techie (Novice) on Feb 11, 2009 at 13:19 UTC
    Hi Martin,
    Thanks for your reply. I do accept that getTable call is wrong, that I've misplaced the colon, but apart from that the actual problem is that I just want to know why the error "can't call method readystate with undef value" is thrown.
    Actual Scenario:
    Our application login page has two textfileds username and password. These text fields are incorporated in tables associated with classes. I've used "getTable" of IEAutomation along with the name of the textfield "username". But still am getting the error "can't call method readystate with undef value". Again I've provided my code below. Appreciate your assistance.
    use strict; use warnings; use win32::IEAutomation; use Win32::IEAutomation::Element; use Win32::IEAutomation::Table; use Win32::IEAutomation::WinClicker; my $IE = Win32::IEAutomation->new( visible => 1, maximize => 1); $IE->gotoURL('http://url') ; $IE->WaitforDone; $IE->getTable("class:", "as_txt_logincm_font_header_normal")->getTextB +ox('name:',"txtUserName")->SetValue('user1>');
    Thank You,
    Saravanan.S

      I think you have perhaps missed the point I tried to make, where in the documentation does it say you can use getTextBox in conjunction with getTable? Why didn't you simply modify my example to match your needs?:

      $ie->getTextBox('name:', "txtUserName")->SetValue("user1");

      Is there only one text box named txtUserName on the page? The documentation states "If there are more than one object having same value for the option you are quering, then it returns first object of the collection.".

      As I mentioned previously, I have never used Win32::IEAutomation, I tend to use WWW::Mechanize (Win32::IE::Mechanize at a push) which has (IMHO) better methods for filling in forms.

      Cheers,

      Martin