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.

_assertExists for _title()

venkateshvenkatesh Members
edited November -1 in Sahi - Open Source
Can i use _assertExists() function to check the page title?

Comments

  • Hi Venkatesh,

    If a page doesn't contain a title, _title() will always return a blank string (""). So, we can't use _assertExists() to check whether the page has the title or not.

    If you want to check this, you can use _assertNotEqual("", _title(), "No title for this page").
  • Hi Boopathi,
    But _assertNotEqual() will return nothing. i want to execute some statements based on the page loaded. if page 1 loaded... execute 1,2,3 statements. if page 2 loaded.. .execute 4,5,6 statements. how to do this.

    And one more issue.... how can i count the textbox's available on the page.

    thanks
    venkatesh
  • Hi Venkatesh,

    _assertNotEqual() is used for assertions.

    You need an if condition in your case.

    if(_title() == 'page1') {
    //statement;
    }

    if(_title() == 'page2') {
    //statement;
    }

    Please create a new thread for unrelated queries. Could you please create a new post for your textbox count problem?
Sign In or Register to comment.