rizzy has asked for the wisdom of the Perl Monks concerning the following question:
I am using `Win32::IEAutomation` in perl to fill in a form and search, but when I use getButton()->Click I get the error "Can't call method "Click" on an undefined value". I am able to click an image (which executes javascript), but not the button.
I noticed in the documentaion for Win32::IEAutomation that it says the following under both "getImage" and "getLink", but NOT under "getButton":
"As it uses click method of DOM, it supports clicking link with javascript in it."
Can anyone tell me how to click the button and fire the javascript?
Here is a skeleton of my code. The final line is the one that gives me trouble.:
use Win32::IEAutomation; my $ie = Win32::IEAutomation->new( visible => 1); $ie->gotoURL('https://www.mywebpage.com/index.html',1); $ie->getTextBox('id:', "mytextbox")->SetValue("relevant text"); $ie->getButton('id:', "mybutton")->Click;
and here is the relevant part of the html:
<input type="text" id="mytextbox" /> <button id="mybutton" title="Go" class="ControlButton" value="Go" +onclick="researchLookupObj.GoClick(CallServer);return false;">Search< +/button>
I am able to get the textbox to fill in (and am able to click on an image earlier in the code which is not shown here), but get the error with the button. How can I tell it to execute the javascript named researchLookupObj.GoClick()?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to get javascript to exectue when clicking a button in IEAutomation?
by Anonymous Monk on May 18, 2012 at 19:09 UTC |