protected void doStep()

in mustella/src/main/java/marmotinni/SetProperty.java [43:74]


    protected void doStep()
    {
		String valueString = null;
		if (valueExpression != null)
        {
            valueString = valueExpression.replace("value =", "");
        }
		else if (value != null)
		{
			if (value.equalsIgnoreCase("false") || value.equalsIgnoreCase("true"))
				valueString = value;
			else {				
				try {
					Double.parseDouble(value);
					valueString = value;
				}
				catch (Exception e) {
					valueString = "'" + value + "'";
				}
			}
		}
		else
			valueString = "null";
		
		StringBuilder setScript = new StringBuilder();
		insertTargetScript(setScript, target);
		setScript.append("if (typeof(target['set_' + '" + propertyName + "']) == 'function') target['set_' + '" + propertyName + "'](" + valueString + ");");
		setScript.append(" else target['" + propertyName + "']=" + valueString + ";");
		if (TestStep.showScripts)
			System.out.println(setScript.toString());
		((JavascriptExecutor)webDriver).executeScript(setScript.toString());
    }