I created a function that I use to click a link on a web application web page. When I run the function using IE it works but when I run it on FF I get an error message stating: that this object does not support this property or method.
Here is my code: All help would greatly be appreciated.
Dim oAnchors Dim oAnchor Dim blnFound
'This will grab all of the links in the page. Set oAnchors = Browser(BName).Page(PName).Object.GetElementsByTagName("A")
blnFound =False ForEach oAnchor in oAnchors <-Here is where I get the error in FF
'Use some property to identify which link you are on'And if it's the right one
If oAnchor.innertext = LinkText Then oAnchor.Click() blnFound =True EndIf
The DOM structure/architecture used on Internet Explorer is not the same as one used by FireFox, so when creating scripts involving DOM statements, logic dedicated for each environment must be implemented. For more information on each DOM, see:
As a workaround, I would suggest you use a Description object as follows:
Public Function ClickLink(BName,PName,LinkText)
Set oDesc = Description.Create
oDesc("micclass").Value = "Link"
Set links = Browser(BName).Page(PName).ChildObjects(oDesc)
blnFound = False
For i=0 To links.Count - 1
If links.Item(i).GetROProperty("innertext")= LinkText Then
blnFound = True
If blnFound = True Then Exit For
Set oDesc = Nothing
Set links = Nothing
Let me know if this works for you.
“HP Support If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.”