Forum Discussion

jimpson's avatar
jimpson
Contributor
10 years ago

getElementsByTagName Fire Fox Failure

I use the following line to populate an array of links in TC:



var n = Sys.Browser().Page("*").contentDocument.getElementsByTagName("a");





Can someone, preferably a member the SB staff, explain why this call works without issue in IE but fails to return much more than the length when called in FF.

2 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Joshua,


     


    The getElementsByTagName method returns a bit different types of object in IE and FF.


    Refer to this page where a similar question was discussed.


     

  • Is anyone else having issues with this?



    I have tried the following in additon, trying to get all the links on my page:



    * TC/Javascript Methods

    - document.links

    - document.querySelectorAll()

    - FindChild



    * Environment Changes

    - Uninstall/Reinstall TC10.10

    - Uninstall/Reinstall Firefox 27.0.1 and 28.0 (Yes I have the FF28 patch in place)



    What appears to be strange is the fact that some of these methods return arrays of null values, while others return only the count and no array.  Again, this appears to be isolated to FireFox, but I have not attempted Chrome just yet.







    Environment:

    - Windwos 8

    - TC 10.10

    - IE 10

    - FF 27.0.1 & FF 28.0