Set Text in Cell on Table

can you help me to set text in cell on table?
I’ve use this code, but only click without setText.
I’ve try to use method setText, but not available.

2018-08-15_15-17-18.png

Hello Zepri,
did you try to use snedKeys()?
also there is possibility to use javascript to set text in any html object.
please take look at this discussion

I’ve see this code.
in this link, have object.
but in my case, I don’t have specific object, because I only get object table, and identify cell using looping.

driver.executeScript("arguments[0].innerHTML = arguments[1]", Columns_rowEmployeAddSalaryComponent.get(6), '100');

Thank you Andrej, but this is doesn’t work|

This is message error.

[ERROR] - Test Cases/Salary Component/APM_TC_SCR004 FAILED because (of) groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.common.WebUiCommonHelper.findWebElement() is applicable for argument types: (org.openqa.selenium.remote.RemoteWebElement, java.lang.Integer) values: [[[[[[[CChromeDriver: chrome on XP (d147a8a9585706b403287a15fd5c6edd)] -> xpath: //*[@id=“gridSalaryComponentEmployee”]/div/div[6]/div/div/div[1]/div/table]] -> tag name: tr]] -> tag name: td], …]

Possible solutions: findWebElement(com.kms.katalon.core.testobject.TestObject, int), findWebElements(com.kms.katalon.core.testobject.TestObject, int)

Maybe you can help me if you see this html for cell object

Maybe you can help me if you see this html for cell object

tesett.png

that error is because you are trying to use selnium WebElement instad of Katalon

in script you posted in 1st post use

Columns_rowEmployeAddSalaryComponent.get(6).findElement(By.xpath('//input')).sendKeys('100')

instead of Columns_rowEmployeAddSalaryComponent.get(6).sendKeys(1)

Thank you for your respon Andrej.
but, this not working, and this is message error.

[ERROR] - Test Cases/Salary Component/APM_TC_SCR004 FAILED because (of) org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document

(Session info: chrome=68.0.3440.106)

(Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 0 milliseconds

For documentation on this error, please visit: http://seleniumhq.org/exceptions/stale_element_reference.html

Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’

System info: host: ‘DEV10-PC’, ip: ‘192.168.254.28’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_181’

Driver info: com.kms.katalon.selenium.driver.CChromeDriver

Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.35.528161 (5b82f2d2aae0ca…, userDataDir: C:\Users\Zepri\AppData\Loca…}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 68.0.3440.106, webStorageEnabled: true}

Session ID: a68c3c698163abcffe3b1e792cec2e98

*** Element info: {Using=xpath, value=//input}

I’ve use this code.

if (celltext == employeeCode2) {

        Columns_rowEmployeAddSalaryComponent.get(6).click()

Columns_rowEmployeAddSalaryComponent.get(6).findElement(By.xpath(’//input’)).sendKeys(‘100’)

    }

can you please post more HTML - i need to see point that is addressed by
Columns_rowEmployeAddSalaryComponent.get(6) to see how to get to that input field you want to fill.

2018-08-16_8-06-54.png

WebUI.delay(1)Columns_rowEmployeAddSalaryComponent.get(6).findElement(By.xpath('//div[@class="dx-texteditor-container"]/input')).sendKeys('100')

this code set text in other edit text.
so sad…
I’m sorry, because always bother you.
You have other way??

sorry, i dont understand … can you be more descriptive?

this code set text in other edit text.

what do you mean by that?

I’ve use this code.

Columns_rowEmployeAddSalaryComponent.get(6).click()

WebUI.delay(2)

Columns_rowEmployeAddSalaryComponent.get(6).findElement(By.xpath(’//div[@class=“dx-texteditor-container”]/input’)).sendKeys(‘100’)

and after run, this code sendKeys in other field, outside the table.

field.png

question: following code
Columns_rowEmployeAddSalaryComponent.get(6)
address what component? is it field that needs to be filled? or is it part of table and we need to traverse DOM to get to field we need fill?

basicly, this field not part of table.
but I don’t know, why this code sendKeys to this field.
maybe this code read xpath normally, don’t add xpath object Columns_rowEmployeAddSalaryComponent.get(6)

this is HTML for field name salary component.
xpath maybe like object cell on the table

fieldObject.png

what this

findElement(By.xpath('//div[@class="dx-texteditor-container"]/input')).sendKeys('100')

will do is - find first input element of class dx-texteditor-container and send key to it. it looks like first element of that kind is field for Name, next one is salary - field you actually want update.
to check that please try use following:

findElement(By.xpath('(//div[@class="dx-texteditor-container"]/input)[1]')).sendKeys('100')