我使用WebBackedSeleniumDriver使用Selenium客戶端驅動程序2.5.0。我想爲我的測試注入Javascript函數,但遇到了一些麻煩。以下是我初始化我的司機......如何在我的Selenium測試中注入JS函數?
final FirefoxDriver driver = new FirefoxDriver();
selenium = new WebDriverBackedSelenium(driver, baseUrl);
但低於第二行拋出「‘增量’未定義的錯誤。」
selenium.getEval("function inc(x) { return x + 1; }); ");
String incResult = selenium.getEval("inc(5);");
任何想法如何我可以成功地注入一個JavaScript函數用於其他測試?
謝謝, - 戴夫