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 verify an ElementStub containing <br/>

ligangligang Members
edited November -1 in Sahi - Open Source
Hi, guys

I want to verify the div contain "<br/>"
<div class="metadataText">
hello,
<br/>
hello,
<br/>
gangli
</div>

How can I do this, I tried containHTML :
"assertTrue(browser.containsHTML(browser.div("/gangli/"), "<br/>"))"
but it can't work .

Comments

  • Hi ligang,

    Try with the following code,This might help you,
    if(browser.fetch("_sahi._div(0).innerHTML").contains("<br>"))
        System.out.println("<br> Exists");
    else
        System.out.println("<br> doesnot Exist");
    

    Regards,
    Theeran.
Sign In or Register to comment.