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.

How to get the last element?

ilovepumpkinilovepumpkin Members
edited November -1 in Sahi - Open Source
I am testing a Web 2.0 application. There is a dialogue implemented by DIV in the page. Everytime the dialogue pops up, a new DIV is created. So the first time, I can get the dialogue by "div('my dialogue title')" but the second time I have to use "div('my dialogue title[1]')" then the third time "div('my dialogue title[2]')". Certainly this might be a development problem -- they should destroy the previous DIV object, but is there any good way to let me always get the last element in the array? If so I do fail at such kind of case any more. Say, "div(my dialogue title[-1])" -- in Python, we can use the index -1 to get the last element in the array.

Comments

This discussion has been closed.