执行FitNesse脚本时,“实例scriptTableActor。不存在”错误即将发生。任何人都可以解释这个错误的含义吗?
我在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
}
}
当我在FitNesse命令中使用此装置时,会出现这样的错误。
请指导。
答案 0 :(得分:2)
这里有两件事需要注意。首先,我假设您真的试图将其用作脚本表的一部分。为此,脚本表行不能独立。所以你需要一个脚本行。如果您打算使用决策表,则不是这样做的方法。请参阅:http://fitnesse.org/FitNesse.UserGuide.SliM.DecisionTable
其次,我很确定你的行与该方法的签名不匹配。我认为应该是:
/**
* 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
}
}
表格使用中需要方法名称中的所有单词。您在示例区域中遗漏了一些内容。
最后,你的论点被颠倒了。值应该在xpath之前,而不是相反。