18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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 check for hardcoded values?
HI all,
I have a query regarding predefined values that "cannot be changed".
Eg::
In case I set some values like NAME = <text entry>
AGE = <text entry>
(Once a new form with these values has been created ,I've designed my page in such a way that these cannot be changed while editing the form).
Now when i open the page for 'Editing purposes' there are lot of entires that can be edited except for the above listed fields.
In such a case how do i check if they can be editied or not?
should i use _setValue() or _setSelected() and see if it fails? or is there a better approach?
Thanks
OS:: Ubuntu 11.04
Browser :: FF 7.0.1
Sahi :: 3.5
I have a query regarding predefined values that "cannot be changed".
Eg::
In case I set some values like NAME = <text entry>
AGE = <text entry>
(Once a new form with these values has been created ,I've designed my page in such a way that these cannot be changed while editing the form).
Now when i open the page for 'Editing purposes' there are lot of entires that can be edited except for the above listed fields.
In such a case how do i check if they can be editied or not?
should i use _setValue() or _setSelected() and see if it fails? or is there a better approach?
Thanks
OS:: Ubuntu 11.04
Browser :: FF 7.0.1
Sahi :: 3.5
This discussion has been closed.
Comments
After starting the sahi, CTRL+Hover the mouse over the element you want to check. Using the identifier in the controller,Try this
For eg:
if(_textbox("t1").isContentEditable=="true")
_alert("_textbox(t1) is Editable");
This might help you.
Regards,
Theeran.
I tried your approach and here are my findings..
Here is the scenario.
I have a select box using with i chose a value and saved the settings.. Now when i go back to that page and try to edit that select box but its not possible. To verify this i used what you said like so...
I found out the accessor and did this::
_select("direction").isContentEditable, "true"
Ideally this should evaluate to "FALSE" as i cannot change the value already entered in the select box. But it did not work that way and the expression evaluated to "True"
The same goes for textbox as well.
i have this _textbox("to_fs").isContentEditable, "true"
(This should ideally mean that the textbox can be edited, but in my case it cannot be edited as even this is hardcoded already.)
So when i check for the same i get "TRUE" only instead of "False"
Any ideas?
Does "cannot edit elements" mean that these elements are disabled?
If yes, you can use _set($isEditable, element.disabled);
If not, can you point us to your application or a similar example online? You could also send the screenshot of the states of the elements when they are editable/non-editable to support@sahi.co.in
Regards
Sumitra
It would be helpful if you could provide an example (As I'm fairly new to SAHI)
Thanks
Try with the following script,
if(_textbox("t1").disabled=="true")
_alert("_textbox(t1) is Disabled and not Editable");
let us know if the problem persists.
Regards,
Theeran.
Let me give you the scenario again.
take a look at this link.. http://imagebin.org/191920
there you will see couple of select box that cannot be changed(a.k.a disabled) now how do i check for that?
Eg:: the accessor used for "Direction" Label in the image is _select("direction").
Now can you please explain how to get this working?
I've tried with _textbox("t1").disabled == "true" but that does not work.
Thanks
The code should be:
if(_condition(_select("direction").disabled))
_alert("_textbox(t1) is Disabled and not Editable");
You can also use this:
_set($isEditable, _select("direction").disabled);
_assertTrue($isEditable);
Regards
Sumitra