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 object with below properties
outerHTML - <a href="javascript:void(0)" class="eqjs-ep-entity-node-button" savedtabindex="[object Object]" tabindex="-1"></a>
tagName - A
href - javascript:void(0)
When I try to execute the code "entityObj.childNodes[0].childNodes[0].Click()"
In IE and Firefox
entityObj.childNodes[0].childNodes[0].Click() = Trigger the click event properly
In Chrome and Opera
entityObj.childNodes[0].childNodes[0].Click() = Object doesn't support this property or method
Any one suggest a right Click() method which will work in Chrome and Opera?
See the attached object browser screenshot.
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.
Thank you :)