zerocred has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to do a bit of website automation (on a rather heavy javascripted site) using Win32::IEAutomation and having a couple of problems.
Any pointers in the right direction would be gratefully appreciated!
1. Can't seem to use 'id:' to locate element with same name and id locator:
Using 'name:' works!Using 'id:' gives:#this bit works! $ie->getFrame('name:', 'info')->getImage('id:', "selBtn2")->Click();
2. I get an error while trying to access an input element within an iframe in a iframe. I don't know if it is the 'id:' not working or something else. The relevant part of the DOM looks like this (IE DOM Explorer-ish)$ie->getFrame('id:', 'info')->getImage('id:', "selBtn3")->Click(); Use of uninitialized value $id in string eq at C:/Perl/site/lib/Win32/ +IEAutomation.pm line 397. WARNING: No frame is present in the document with your specified optio +n id: info
The code snippet I'm trying to use looks like this:<HTML> #top level document <HEAD> <BODY> <IFRAME id=info> #a another iframe, not a parent of sFrame <DIV id=iframeDisp> <IFRAME id=sFrame> name=sFrame #a child of top #document <HTML> <HEAD> <BODY> <IFRAME id=accFrame> #frame within sFrame #document <HTML> Tables+Tables...more stuff <INPUT class inputFld> #name=account
Using 'id:' to locate sFrame doesn't seem to work either as mentioned above.$ie->getFrame('name:','sFrame')->getFrame('id:', 'accFrame')->getTextB +ox('name:', "account")->SetValue($user)
This produces no error:Use of uninitialized value $name in string eq at C:/Perl/site/lib/Win3 +2/IEAutomation.pm line 405. Use of uninitialized value $id in string eq at C:/Perl/site/lib/Win32/ +IEAutomation.pm line 397. Use of uninitialized value $id in string eq at C:/Perl/site/lib/Win32/ +IEAutomation.pm line 397. Use of uninitialized value $id in string eq at C:/Perl/site/lib/Win32/ +IEAutomation.pm line 397. Use of uninitialized value $id in string eq at C:/Perl/site/lib/Win32/ +IEAutomation.pm line 397. Use of uninitialized value $id in string eq at C:/Perl/site/lib/Win32/ +IEAutomation.pm line 397. WARNING: No frame is present in the document with your specified optio +n id: accFrame Can't call method "getTextBox" without a package or object reference a +t D:\dev\ieautomate\ieauto1.pl line 42.
This produces unitialized $id error:$ie->getFrame('name:', 'sFrame');
$ie->getFrame('name:', 'sFrame')->getFrame('id:','accFrame');
Use of uninitialized value $id in string eq at C:/Perl/site/lib/Win32/ +IEAutomation.pm line 397. Use of uninitialized value $id in string eq at C:/Perl/site/lib/Win32/ +IEAutomation.pm line 397. Use of uninitialized value $id in string eq at C:/Perl/site/lib/Win32/ +IEAutomation.pm line 397. Use of uninitialized value $id in string eq at C:/Perl/site/lib/Win32/ +IEAutomation.pm line 397. Use of uninitialized value $id in string eq at C:/Perl/site/lib/Win32/ +IEAutomation.pm line 397. WARNING: No frame is present in the document with your specified optio +n id: accFrame
I don't know why the error lines are repeated.
Could it be the DIV elements in between the IFRAMEs need to be navigated? - if so, how to navigate?
I tried Selenium and got it working but would run into intermittent 'cannot find element' errors while trying to locate elements inside frames, this defeated me. It was rather slow too taking about 2s per click -so that's why I'm trying IEAutomation.
Comments and suggestions welcome!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to use IEAutomation with iframes?
by ww (Archbishop) on Mar 11, 2010 at 15:48 UTC | |
by zerocred (Beadle) on Mar 12, 2010 at 00:50 UTC | |
by zerocred (Beadle) on Mar 13, 2010 at 10:36 UTC | |
by zerocred (Beadle) on Mar 13, 2010 at 10:57 UTC | |
by Anonymous Monk on Mar 13, 2010 at 10:59 UTC | |
by zerocred (Beadle) on Mar 13, 2010 at 11:24 UTC |