Search code examples
groovyfitnesse

When executing FitNesse script, "The instance scriptTableActor. does not exist" error is coming. Can any one explain the meaning of this error?


When executing FitNesse script, "The instance scriptTableActor. does not exist" error is coming. Can any one explain the meaning of this error ?

I have created a fixture in eclipse :

/**
 * To enter text or numbers in a text field, add this row to your FitNesse script table:
 * <html> <br/> <br/>
 *    | Enter value xpath | value | in field |fieldXpath |
 *    <br/> <br/>
 * </html>
 * tags: setter
 * @param fieldXpath the field xpath assigned to the target field
 * @param input the characters to be entered
 * @return true if text entered successfully
 */
public boolean EnterValueInFieldByXpath(String xpath, String value) {
    try {
        println "in the EnterValueInFieldByXpath method "
        WebElement e = driver.findElement(By.xpath(xpath))
        e.clear()
        e.sendKeys(value)
        return true
    } catch (Exception e) {
        println "apparently did not find the $xpath Link: ${e}"
        return false
    }

}

When I use this fixture in FitNesse command such error is coming.

Please guide.


Solution

  • Well there are two things going on here of note. First is that I assume you really are trying to use this as a part of a script table. To that end, script table rows can't be free-standing. So you need a script row. If you are intending a decision table, this isn't the way to do it. See: http://fitnesse.org/FitNesse.UserGuide.SliM.DecisionTable

    Second, I'm pretty sure that your row isn't matching the signature of the method. I think it should be:

    /**
     * To enter text or numbers in a text field, add this row to your FitNesse script table:
     * <html> <br/> <br/>
     *    | Enter value | value | in field |field| by xpath |
     *    <br/> <br/>
     * </html>
     * tags: setter
     * @param fieldXpath the field xpath assigned to the target field
     * @param input the characters to be entered
     * @return true if text entered successfully
     */
    public boolean EnterValueInFieldByXpath( String value, String xpath) {
        try {
            println "in the EnterValueInFieldByXpath method "
            WebElement e = driver.findElement(By.xpath(xpath))
            e.clear()
            e.sendKeys(value)
            return true
        } catch (Exception e) {
            println "apparently did not find the $xpath Link: ${e}"
            return false
        }
    
    }
    

    All of the words in the method name are required in the table use. You were missing some in the example area.

    Finally, you had your arguments reversed. Value should have been before xpath, not the other way around.