in reply to How to use IEAutomation with iframes?

Though I can't cite a reference, offhand, and thus am uncertain that my recall is accurate, I believe I discovered some years ago that some authorities deprecate use of id="xyz" as the sole ident in an html tag "attribute=value" pair. The rationale, IIRC, is that some tools fail to parse it correctly (perhaps, ??, because of a conflict with use of id in css??

In any case, I have utilized the proposed cure -- namely, adding name="xyz" (where xyz is identical to the value in the id="xyz") -- and that has consistently worked, over multiple sites, browsers, versions and hosts.

I conceed, this may be OT or even irrelevant, but your statement

Using 'name:' works!
$ie->getFrame('name:', 'info')->getImage('id:', "selBtn2")->Click();

leads me to suspect you control the website content and could thus make the necessary changes... perhaps even fairly painlessly.

Replies are listed 'Best First'.
Re^2: How to use IEAutomation with iframes?
by zerocred (Beadle) on Mar 12, 2010 at 00:50 UTC
    Hi,

    Thanks, I used CSS in Selenium and that worked OK - except for the intermittent cannot find element error (which is something to do with frames too I believe), but IEAutomation doesn't seem to support the use of CSS.

    It just so happens the first frame sFrame has both an 'id' and 'name' attribute that are both the same. Using the 'name' to locate the frame seems to work, using id does not - it led me to wonder was there a bug in the IEAutomation code - I looked at the source but the id and name functions looked so similar. The second child frame only has an 'id' so I can't avoid using it.

    Using 'id' for the image element seems to work ok.

    I don't control the site unfortunately so can't make the changes.

    So I'm a bit stuck.

      Following up on the id & name locators, I found this on w3.org site:

      "12.2.3 Anchors with the id attribute
      ...
      The id and name attributes share the same name space. This means that they cannot both define an anchor with the same name in the same document. It is permissible to use both attributes to specify an element's unique identifier for the following elements: A, APPLET, FORM, FRAME, IFRAME, IMG, and MAP. When both attributes are used on a single element, their values must be identical."

      I tried using 'name:' instead of 'id:' and it fails if there is no name attribute. So they don't seem interchangeable.
        Further investigation reveals that the iframe source is loaded from another URL which I think is not loaded by IEAutomation - thus IEA cannot find the contents of the first iframe...

        But then, the iframe contents show up on the IE screen... hmmm so it must be there...somewhere

        I need mroe sleep.

        Using the URL of the relevant iframe as the IEAutomation source URL I can identify and fill in the account name textbox with this snippet:

        $ie->getTextBox('name:', "account")->SetValue($user)

        Still need to figure out how to locate it from the parent iframes...