TestProject Forum
Powered by leading experts in the test automation community

JavaScriptExecutor FuelUX Repeater assign value to search page input element

I am trying to assign a value to a FuelUX Repeater’s input via JavaScriptExecuter.
http://getfuelux.com/javascript.html#repeater

WebElement repeater = driver.findElement(By.id("repeaterIllustration")); WebElement repeaterPagination = repeater.findElement(By.xpath( "//div[contains(@class, 'repeater-pagination')]")); WebElement pageInput = repeaterPagination.findElement(By.xpath("//input[contains(@class, 'repeater-secondaryPaging')]"));

For some reason I am not able to assign the value ‘9’ to the Repeater’s page input :

jsDriver = (JavascriptExecutor) driver; jsDriver.executeScript("arguments[0].val('9')", pageInput);

Any help would be appreciated.

.val() is a jQuery function and it will not run on an object that is not wrapped by jQuery.

You could try wrapping it with the $ sign like so:

jsDriver.executeScript("$(arguments[0]).val('9')", pageInput);

Or you just could use pure JavaScript:

jsDriver.executeScript("arguments[0].val = 9", pageInput);