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.

assertion for lastDownloadedFileName

ssikdarssikdar Members
edited November -1 in Sahi - Open Source
OS Name Windows
Browser Name IE9
Sahi Build Sahi Prp v 4.2

Hi,

IN our application, every new download generates a PDF with the name format as activity_report_new_<dynamic_id>.pdf.

Hence I cannot use assertEqual function.

Can I use assertContainsText() ?

I tried the below

_assertContainsText("activity_report_new", _lastDownloadedFileName());

however there is an error on script execution

assertContainsText("activity_report_new", _lastDownloadedFileName()); TypeError: Unable to get value of the property 'indexOf': object is null or undefined No trace available Click for browser script [10813 ms] [05:00:09.640]

Comments

  • globalwormingglobalworming Moderators
    Hi

    as the filename is a string, this will not work, it doesn't contain text... but maybe try this _assertTrue(_lastDownloadedFileName().match("/activity_report_new/"))

    Regards
    Wormi
Sign In or Register to comment.