lihua
New Member
Posts: 8
|
Post by lihua on Aug 21, 2015 3:28:28 GMT
I encountered a problem in my SeleniumPlus test with below statement.
EditBox.SetTextValue(myTextBox,GetVariableValue(Map.myTitle));
This statement is to write a string to a textInput component. But if the string get from function “GetVariableValue(Map.myTitle)” contains minus symbol “-“, the string filled in the textInput becomes to “0”. My coworker explained to me that this is because the string is treated as expression and the value “0” is the calculation result.
She gave me a workaround for this kind of problem: to add “quote” around the function as below.
EditBox.SetTextValue(myTextBox, quote(GetVariableValue(Map.myTitle)));
And this worked successfully for me.
|
|
|
Post by leiwang on Aug 21, 2015 3:48:05 GMT
First, would you please change the title . This question is about Expression on/off, not about "Component.InputKeys vs. Component.InputCharacters". Second, I would recommend you to read our java doc at safsdev.github.io/doc/org/safs/selenium/webdriver/SeleniumPlus.html, in the "NOTE 1: Auto-evaluated expression.", we explain the "Expression". To avoid the expression evaluation, there are 2 ways: 1. Use quote() to quote the string, which works for this special string. 2. Turn off the expression by calling Misc.Expressions(false), which works for the rest of your test script.
|
|
lihua
New Member
Posts: 8
|
Post by lihua on Aug 21, 2015 6:17:44 GMT
Thanks Lei very much for the reminding. I have changed the topic title accordingly.
|
|