Forum Discussion

jack_edwards's avatar
jack_edwards
Occasional Contributor
10 years ago

Invalid Callee in Firefox

TC10 does not add empty span objects to the object browser, which means you can't add them to your NameMapping file.  I am using the code below to click one of these empty span objects in order to work around this 'feature'.  The code works fine in IE 11 and Chrome, but returns a VBScript runtime error when used in Firefox.

 

VBScript runtime error:  Invalid callee

Any ideas on a work-around?  Google isn't turning up anything useful.

 

Field = "Aliases.App.SendEmailForm.EmailIconBar"
Value = "Send Email" 

Set objField = Eval(Field)
    
    For i = 0 to objField.childElementCount - 1
        Set ChildItem = objField.children.item(i) 'Firefox - Runtime error: Invalid Callee
        If ChildItem.nodeName = "SPAN" Then
            If ChildItem.Title = Value Then
                '# ChildItem.Click only works in IE.  The Click method doesn't exist for this object in Chrome or FF
                'ChildItem.Click
                '# Rect works for IE and Chrome.
                Set Rect = ChildItem.getBoundingClientRect()
                x = Rect.right - Rect.left + 1
                y = Rect.bottom - Rect.top + 1
                Call objField.Click(x, y)
                fClickEmptySpan = 1
                Exit Function
            End If
        End If
    Next

 

<div class="emailIconBar">

    <span class="uIcon hover send" onclick="sendEmail(this)" title="Send Email"></span>
    <span class="uIcon hover saveDraft" onclick="SaveDraft(this)" title="Save as Draft"></span>
    <span class="EmailBranchSetupError"></span>
    <span class="DocumentSelect hide" style="display: none;"></span>

</div>


This recent topic covers the same kind of issue, but it didn't look like Firefox was being tested:  http://community.smartbear.com/t5/Functional-Web-Testing/Click-method-not-accepted-in-chrome/m-p/100484#U100484

 

  • Hi Jack,

     

    I’m not sure. However, can you check if the following script works for you?

    var obj = // obtain the path to the emailIconBar object;
     
    //find the html element
    var obj = page.FindChildByXPath("//SPAN[@class='DocumentSelect hide']", false);
     
    // Check the result
    if (obj != null)
    {
       // If the element was found, click it
       obj.Click();
    }
    else
       Log.Error("The element was not found.");

     

    I’m referring to the HTML source of the page and looking for the hidden HTML object. Please read the "Finding Web Objects Using XPath Expressions" (http://smartbear.com/viewarticle/62117/ ) help topic for details.

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Jack,

     

    I’m not sure. However, can you check if the following script works for you?

    var obj = // obtain the path to the emailIconBar object;
     
    //find the html element
    var obj = page.FindChildByXPath("//SPAN[@class='DocumentSelect hide']", false);
     
    // Check the result
    if (obj != null)
    {
       // If the element was found, click it
       obj.Click();
    }
    else
       Log.Error("The element was not found.");

     

    I’m referring to the HTML source of the page and looking for the hidden HTML object. Please read the "Finding Web Objects Using XPath Expressions" (http://smartbear.com/viewarticle/62117/ ) help topic for details.

    • jack_edwards's avatar
      jack_edwards
      Occasional Contributor

      Tanya,

      This works perfectly in IE, FF, and Chrome.  Thanks!

       

      Edit:  Well, almost perfectly.  The "Click" method doesn't exist for the hidden object in Chrome or FF.  I still had to draw the rectangle around the object and click inside the rectangle.