Forum Discussion

CMA_Senthil's avatar
CMA_Senthil
Occasional Contributor
9 years ago
Solved

What is an appropriate method to perform a native click in Chrome and Opera?

 Hi,   I have an issue with native click in Chrome and Opera. I have the below line of code in my script which retuens an anchor link   entityObj.childNodes[0].childNodes[0] - This returns an obj...
  • TanyaYatskovska's avatar
    9 years ago

    Hi Senthil,

     

    I would suggest that you use TestComplete's special methods, EvaluteXPath of FindChildByXPath, to get an object based on it's HTML information. Here is an example:

    // Call the function
    var obj = page.FindChildByXPath("//A[@class='eqjs-ep-entity-node-button')]", true);
    
    // Check the result
    if (obj != null)
    {
    // If the element was found, click it
    obj.Click();
    }
    else
    {
    // If the element was not found, post a message to the log
    Log.Error("The element was not found.");
    }

     

    Your code may not work because of the different object trees that browsers can create in a different way.

  • CMA_Senthil's avatar
    CMA_Senthil
    9 years ago

    Thank you :)