Forum Discussion

KB1's avatar
KB1
Champion Level 2
3 years ago

ClickItem is not a function

Hello,

I've been doing scripting tests for a while now..
Now I ran up to this problem with the ClickItem();
It says that it is not a function but I configured it the same way as I always do.
What is wrong with my code? 

 

  • I've noticed you are using FindElements(), which returns a list of objects. As opposed to FindElement(), which returns an object. Also, since the item has changed from "select" to "manage" - I think the id has changed?

     

    If you want to see whether your statement is correct in picking the correct UI object, then try highlighting it

    function test()
    {
        var roleACL = frame.FindElement(...);
        if (roleACL.Exists) {
            Sys.HighlightObject(roleACL);
        }
    }

     

    • KB1's avatar
      KB1
      Champion Level 2

      The xPath which the roleACL goes  to is this dropdownbox

       

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    One thing I've noticed with various web controls, especially with dropdown boxes. I have to perform a click, to expand the dropdown box, and then perform clickitem to select the item. This is how the UI object is constructed, and how it looks in TCs' object tree

     

    If you record your actions using keyword test, and then convert to scripts. You'll see the actual steps involved to select the item.

     

    if you print,

    Log.Message(roleACL.ObjectType);

    What does it show? 

    • KB1's avatar
      KB1
      Champion Level 2

      Shows the same error....

      After keyword testing and converted it to script based testing. shows the same and only step. the ClickItem.

      But the problem is that, that xPath goes to a row. and not always to the one I need. and I cannot put paramers in namemapping.


      How can i fix it?
      Is there any other way? 

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    I've noticed you are using FindElements(), which returns a list of objects. As opposed to FindElement(), which returns an object. Also, since the item has changed from "select" to "manage" - I think the id has changed?

     

    If you want to see whether your statement is correct in picking the correct UI object, then try highlighting it

    function test()
    {
        var roleACL = frame.FindElement(...);
        if (roleACL.Exists) {
            Sys.HighlightObject(roleACL);
        }
    }

     

    • KB1's avatar
      KB1
      Champion Level 2

      Haahah yeah that was the problem that "S", thank you for looking with me.