Which is the XLT Enter command?


#1

How to pass a enter key in search box via XLT ?

In Selenium we use this below code:-

WebElement searchEle = driver.findElement(By.xpath(locator.getProperty("search.box").toString()));
searchEle.sendKeys(productName);
searchEle.sendKeys(Keys.RETURN);

What is its replacement in XLT ?
i found type(), click() and check() , but all these functions use strings as arguments,
How to pass enter key code in xlt ?


#2

All these commands take only string arguments because these are the Java-Land counterparts of the Scripting API introduced with ScriptDeveloper.

If you want to submit the form that owns the input element you’re typing into, just append a new-line character to the input string: productName + "\n"

ENTER or other special key codes are not supported by Scripting API. But you can request the currently used WebDriver instance at any time and use your code above.