Reputation: 93
This is my code
WebUI.openBrowser('')
WebUI.navigateToUrl('https://techcrunch.com/')
WebUI.click(findTestObject('Object Repository/newww/Page_TechCrunch Startup and Technology News/div_Searchsearch'))
WebUI.setText(findTestObject('Object Repository/newww/Page_TechCrunch Startup and Technology News/input_Close Search_p'),
'mobile')
WebUI.sendKeys(findTestObject('newww/Page_TechCrunch Startup and Technology News/form_search'), ((Keys.ENTER) as String))
WebUI.closeBrowser()
I get this error Test Cases/TestRecord FAILED. Reason: com.kms.katalon.core.exception.StepFailedException: Unable to send keys '' to object 'Object Repository/newww/Page_TechCrunch Startup and Technology News/form_search' at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64) at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26) at com.kms.katalon.core.webui.keyword.builtin.SendKeysKeyword.sendKeys(SendKeysKeyword.groovy:60) at com.kms.katalon.core.webui.keyword.builtin.SendKeysKeyword.execute(SendKeysKeyword.groovy:38) at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72) at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.sendKeys(WebUiBuiltInKeywords.groovy:834) at TestRecord.run(TestRecord:28) at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194) at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119) at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337) at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328) at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307) at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299) at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233) at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114) at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105) at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source) at TempTestCase1579268178976.run(TempTestCase1579268178976.groovy:23) Caused by: org.openqa.selenium.ElementNotInteractableException: element not interactable (Session info: chrome=79.0.3945.130) Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' System info: host: 'MiniMes-Mac-mini.local', ip: '192.168.0.101', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.5', java.version: '1.8.0_181' Driver info: com.kms.katalon.selenium.driver.CChromeDriver Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 79.0.3945.130, chrome: {chromedriverVersion: 79.0.3945.36 (3582db32b3389..., userDataDir: /var/folders/p3/2yjl_8ks615...}, goog:chromeOptions: {debuggerAddress: localhost:61702}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: MAC, platformName: MAC, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify} Session ID: 37e756b80492ea71b8839b0087072e97 at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:19) at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285) at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:106) at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement.lambda$new$0(EventFiringWebDriver.java:404) at com.sun.proxy.$Proxy10.sendKeys(Unknown Source) at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement.sendKeys(EventFiringWebDriver.java:429) at com.kms.katalon.core.webui.keyword.builtin.SendKeysKeyword$_sendKeys_closure1.doCall(SendKeysKeyword.groovy:53) at com.kms.katalon.core.webui.keyword.builtin.SendKeysKeyword$_sendKeys_closure1.call(SendKeysKeyword.groovy) at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20) ... 16 more
Upvotes: 1
Views: 3755
Reputation: 548
As I understand, you want to type some text in search field and then hit the enter ? After typing text in the search field, use sendKeys method.
WebUI.sendKeys(findTestObject('your object goes here'), Keys.chord(Keys.ENTER))
But before using this, you need to import following library:
import org.openqa.selenium.Keys as Keys
Upvotes: 2