18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Is it a good idea to access element by TagName?It has worked till now.

brajeshbrajesh Members
edited November -1 in Sahi - Open Source
In Sahi script I am accessing elements for condition check like (top.document.getElementsByTagName('input')[4]=="Some Text") and it has worked till now for me. But I am not sure what can be consequences of this in future, I know it's always good to access elements by ID but I am not able to locate ID part?

Comments

  • sumeetsumeet Members
    edited May 2009
    you can use jquery selectors to identify the elements if a particular element does not have id, we used something like -

    _assertContainsText("Invalid date format",$(".errormessagecontainer")[0]); ---- for the error messages displayed on the page and does not contain the id

    here "errormessagecontainer" is the class name of the DIV and [0] is the occurrence of that class on the page.
Sign In or Register to comment.