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.

Testing for readonly and disabled checkbox from junit

patpro123patpro123 Members
edited November -1 in Sahi - Open Source
Hi

Firstly, a big round of applause for such a good work! My project is deep into ZK, so we'll surely try and use Sahi(with your help offcourse!).

My project uses junit integrated with Sahi for test automation. I am facing some problem in asserting the disabled or readonly state of a textfield(or any field for that matter), from my junit code. I tried the following:

browser.popup("previewwin").textbox("z-textbox[1]").isVisible()

which gives proper result for visibility. But the ElementStub API does not give us something like
.disabled or .readonly.

Please help

Comments

  • narayannarayan Administrators
    This is what you need:

    browser.popup("previewwin").textbox("z-textbox[1]").fetch("disabled")

    Javascript attributes which are not exposed via Sahi's APIs directly, can be fetched using the "fetch" API.

    Regards,
    Narayan
  • Hi narayan

    Thanks for the reply... I tried this out and it is working fine... also I had to check a fields disable behaviour as follows and it works..

    assertTrue("true".equals(browser.popup("previewwin").textbox(1).fetch("readOnly")));

    I have another problem:

    When I am writing a junit and running the same, it is always running all the methods in the junit class together even if I select a method individually and run. I have also tried adding a new junit configuration for the particular method and running, but with no luck.. But a for a non-sahi junit runs fine individually. Could you help?
  • Hi,
    Please create a new thread for unrelated queries. Could you please create a new post for your junit problem?
Sign In or Register to comment.