I wrote custom tag, but still having problem to set text field.
Below is source of custom tag
--------------------------------------------------------------------------
import net.sf.jameleon.plugin.jiffie.tags.IEFireEventTag;
/**
* DESCRIPTION GOES HERE
* @jameleon.function name="product-search" type="action"
* @jameleon.step Set searchTextField text field ID if value is provided
*/
public class SearchProductTag extends IEFireEventTag{
/**
* the form identifier
* @jameleon.attribute default="1"
*/
protected String formIdentifier;
/**
* The name, id or index of the field
* @jameleon.attribute contextName="ieValidateTextFieldForm"
*/
protected String form;
/**
* searchTextField
* @jameleon.attribute required="false"
*/
protected String searchTextField;
/**
* The value to set the text field to
* @jameleon.attribute required="true" contextName="ieSetTextFieldValue"
*/
protected String value;
public void testBlock(){
setWorkingForm(form);
if ( searchTextField != null ){
fireEvent(setTextFieldValue(searchTextFieldID, searchTextField));
}
//submitWorkingForm();
}
/**
* searchTextField's field id
*/
protected String searchTextFieldID = "searchTextField";
}
Custom tag itself
---------------------------
<jm:product-search
functionId="Enter product code - '${csvProdCode}' into text field"
frameName="frameset,menutree,menuTree"
form="oForm"
searchTextField="searchTextField"
value="${csvProdCode}"
eventToFire="onkeyup"
functionDelay="300"/>
Please check what should be done to make custom tag working?
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Christian,
How I can set test field if <input> tag doesn't have 'name' attribute?
<form id="oForm" onsubmit="submitSearch();return false">
<div><input type="text" class="form-control" id="searchTextField" size=25 onkeyup="checkField(this.value)" onpaste="checkField(clipboardData.getData('Text'))" onclick="checkField(this.value)"></div>
Error Message: searchTextField does not exist as a text field in the current form!
My tag:
<jm:ie-set-text-field
functionId="Enter product code - '${csvProdCode}' into text field"
frameName="frameset,menutree,menuTree"
name="earchTextField"
value="12345"
eventToFire="onkeyup"
functionDelay="300"/>
Please advice?
I made typo
My tag:
<jm:ie-set-text-field
functionId="Enter product code - '12345' into text field"
frameName="frameset,menutree,menuTree"
name="searchTextField"
value="12345"
eventToFire="onkeyup"
functionDelay="300"/>
As far as I know, you'll need to write a custom tag until I get around to supporting XPath in that tag.
I wrote custom tag, but still having problem to set text field.
Below is source of custom tag
--------------------------------------------------------------------------
import net.sf.jameleon.plugin.jiffie.tags.IEFireEventTag;
/**
* DESCRIPTION GOES HERE
* @jameleon.function name="product-search" type="action"
* @jameleon.step Set searchTextField text field ID if value is provided
*/
public class SearchProductTag extends IEFireEventTag{
/**
* the form identifier
* @jameleon.attribute default="1"
*/
protected String formIdentifier;
/**
* The name, id or index of the field
* @jameleon.attribute contextName="ieValidateTextFieldForm"
*/
protected String form;
/**
* searchTextField
* @jameleon.attribute required="false"
*/
protected String searchTextField;
/**
* The value to set the text field to
* @jameleon.attribute required="true" contextName="ieSetTextFieldValue"
*/
protected String value;
public void testBlock(){
setWorkingForm(form);
if ( searchTextField != null ){
fireEvent(setTextFieldValue(searchTextFieldID, searchTextField));
}
//submitWorkingForm();
}
/**
* searchTextField's field id
*/
protected String searchTextFieldID = "searchTextField";
}
Custom tag itself
---------------------------
<jm:product-search
functionId="Enter product code - '${csvProdCode}' into text field"
frameName="frameset,menutree,menuTree"
form="oForm"
searchTextField="searchTextField"
value="${csvProdCode}"
eventToFire="onkeyup"
functionDelay="300"/>
Please check what should be done to make custom tag working?
Thanks.
Try:
...
if ( searchTextField != null ){
IHTMLInputElement searchField = (IHTMLInputElement)getIHTMLElement("input", "id", searchTextFieldID);
assertNotNull("Can not find search field '"+searchFieldId+"'", searchField);
searchField.setValue(searchTextField);
fireEvent(searchField);
}
...
I'm getting error in source file.
"IHTMLInputElement cannot be resolved to a type"
Line:
IHTMLInputElement searchField = (IHTMLInputElement)getIHTMLElement("input", "id", searchTextFieldID);
Did you import com.tapsterrock.jiffie.IHTMLInputElement?
I forgot to add import. Now its work fine.
Thank you for help.