public void enterTextIntoWebElement ( final By by , final String text ) { if ( by instanceof By . Id ) { executeJavaScriptFunction ( "enterTextById(\"" + by . getValue ( ) + "\", \"" + text + "\");" ) ; } else if ( by instanceof By . Xpath ) { executeJavaScriptFunction ( "enterTextByXpath(\"" + by . getValue ( ) + "\", \"" + text + "\");" ) ; } else if ( by instanceof By . CssSelector ) { executeJavaScriptFunction ( "enterTextByCssSelector(\"" + by . getValue ( ) + "\", \"" + text + "\");" ) ; } else if ( by instanceof By . Name ) { executeJavaScriptFunction ( "enterTextByName(\"" + by . getValue ( ) + "\", \"" + text + "\");" ) ; } else if ( by instanceof By . ClassName ) { executeJavaScriptFunction ( "enterTextByClassName(\"" + by . getValue ( ) + "\", \"" + text + "\");" ) ; } else if ( by instanceof By . Text ) { executeJavaScriptFunction ( "enterTextByTextContent(\"" + by . getValue ( ) + "\", \"" + text + "\");" ) ; } else if ( by instanceof By . TagName ) { executeJavaScriptFunction ( "enterTextByTagName(\"" + by . getValue ( ) + "\", \"" + text + "\");" ) ; } }
Enters text into a web element using the given By method