Forum Discussion

IndraO's avatar
IndraO
New Contributor
3 years ago

Find methods with array's of properties and values doesn't work

I saw in the documentation that you can pass along multiple properties in some of the Find methods. I have now tried to implement this twice and I still can't get it to work.

 

I'm trying to find an 'a' element so I can click on it. First I make sure the menu with the link visible is opened. Then I declare the array's and then I try to find the object. You can see my code here:

page.formWelkom.textnode.textnodeBasisgegevens.imageIconMenuPng.Click();
let PropArray = new Array("href", "VisibleOnScreen");
let ValuesArray = new Array("/Lis/Schuttingen.aspx", true);

let obj = page.Find(PropArray, ValuesArray, 100);
obj.Click();

 

In the screenshot you can clearly see the link visible on the screen.

 Can anyone please help me with this?

  • I've used the Object Spy tool to find the following object.

    And the coding works using pathname as opposed to href

    function Test()
    {
        var PropArray = new Array("pathname", "VisibleOnScreen");
        var ValuesArray = new Array("/223/BulkAnnuity", true);
    
        var item = Aliases.panelDashboard.Find(PropArray, ValuesArray);
        if (item.Exists) {
            Sys.HighlightObject(item);
        } else {
            Log.Error("Item not found");
        }
    }

     

     

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    I've used the Object Spy tool to find the following object.

    And the coding works using pathname as opposed to href

    function Test()
    {
        var PropArray = new Array("pathname", "VisibleOnScreen");
        var ValuesArray = new Array("/223/BulkAnnuity", true);
    
        var item = Aliases.panelDashboard.Find(PropArray, ValuesArray);
        if (item.Exists) {
            Sys.HighlightObject(item);
        } else {
            Log.Error("Item not found");
        }
    }

     

     

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Use TC' Object Spy tool to see what the value of href is.

     

    Here's an example, I'm using wildcard for href

    function Test()
    {
        // Goto https://www.w3schools.com/js/
        var PropArray = new Array("Name", "ObjectType", "VisibleOnScreen", "href");
        var ValuesArray = new Array("Link(0)", "Link", false, "*/default.asp");
    
        var item = Aliases.panelHome.Find(PropArray, ValuesArray);
        if (item.Exists) {
            Sys.HighlightObject(item);
        } else {
            Log.Error("Item not found");
        }
    }

     

    • IndraO's avatar
      IndraO
      New Contributor

      That's not my problem. I want to find the object with a certain href (ex: '/Lis/Schuttingen.aspx') so I can click on the link that leads me to that href. My problem is that this method with the array's acts like it can't find the object even though you can clearly see in my screenshot that it exists and is visible.