Ask a Question

ClickItem is not a function

SOLVED
KB1
Frequent Contributor

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? 

kevinbenson_0-1671712002492.png

 

6 REPLIES 6
rraghvani
Trusted Contributor

What is the object type of "roleACL" ?

KB1
Frequent Contributor

kevinbenson_0-1671712932474.png

The xPath which the roleACL goes  to is this dropdownbox

 

rraghvani
Trusted Contributor

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

rraghvani_0-1671713521175.png

 

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
Frequent Contributor

kevinbenson_0-1671714010363.png

Shows the same error....

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

kevinbenson_1-1671714449473.png

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
Trusted Contributor

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
Frequent Contributor

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

cancel
Showing results for 
Search instead for 
Did you mean: