Cannot set text of web element in iframe Katalon studio

I am using Katalon studio for web UI automation . In one of the element in UI which is in iframe . Katalon is finding the element by using findTestObject.

The error I am getting is

01-30-2018 03:52:56 PM - [FAILED] - Unable to
set text ‘201656’ of object ‘Object
Repository/Pega25/Page_DCDFOUser/input_PpyWorkPagepSortCode’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id:
‘Object Repository/Pega25/Page_DCDFOUser/iframe_PegaGadget1Ifr’ located by
‘By.xpath: //iframe[count(. | //[@name = ‘PegaGadget1Ifr’]) = count(//[@name
= ‘PegaGadget1Ifr’])][count(. | //[@id = ‘PegaGadget1Ifr’]) = count(//[@id =
‘PegaGadget1Ifr’])][count(. | //[@src =
'/prweb/04RbAsalj9MXSlXiS34ETTvROQXb0ZzN0FhlgVCsehk%5B
/!@7afa6cadba4efb3f8494385e37090edd!TABTHREAD1?pyActivity=%40baseclass.doUIAction&action=createNewWork&className=BARC-FBU-DCDisp-Work-Claim&flowName=BeginMultipleTransactionSearch&dynamicContainerID=f9e64470-c4fa-4e63-b814-0a50f75d0647&contentID=32a4838f-4fc8-24b1-e5e8-f23bc491cdfa&tabIndex=2&prevContentID=88d0292e-17d9-4ddd-9c1a-7e474fd0068c&prevRecordkey=Data-Portal%7CpyDashboard7%7Cundefined&portalThreadName=STANDARD&portalName=DCDFOUser&pzHarnessID=HIDECAB8BB655B607F2F63774650DFD19DB’])
= count(//[@src =
'/prweb/04RbAsalj9MXSlXiS34ETTvROQXb0ZzN0FhlgVCsehk%5B
/!@7afa6cadba4efb3f8494385e37090edd!TABTHREAD1?pyActivity=%40baseclass.doUIAction&action=createNewWork&className=BARC-FBU-DCDisp-Work-Claim&flowName=BeginMultipleTransactionSearch&dynamicContainerID=f9e64470-c4fa-4e63-b814-0a50f75d0647&contentID=32a4838f-4fc8-24b1-e5e8-f23bc491cdfa&tabIndex=2&prevContentID=88d0292e-17d9-4ddd-9c1a-7e474fd0068c&prevRecordkey=Data-Portal%7CpyDashboard7%7Cundefined&portalThreadName=STANDARD&portalName=DCDFOUser&pzHarnessID=HIDECAB8BB655B607F2F63774650DFD19DB’])]’
not found)

01-30-2018 03:52:56 PM -
[END] - End action : setText

01-30-2018 03:52:56 PM - [FAILED] - Test
Cases/New Test Case FAILED because (of) Unable to set text ‘201656’ of object
‘Object Repository/Pega25/Page_DCDFOUser/input_PpyWorkPagepSortCode’ (Root
cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id:
‘Object Repository/Pega25/Page_DCDFOUser/iframe_PegaGadget1Ifr’ located by
‘By.xpath: //iframe[count(. | //[@name = ‘PegaGadget1Ifr’]) = count(//[@name
= ‘PegaGadget1Ifr’])][count(. | //[@id = ‘PegaGadget1Ifr’]) = count(//[@id =
‘PegaGadget1Ifr’])][count(. | //[@src = '/prweb/04RbAsalj9MXSlXiS34ETTvROQXb0ZzN0FhlgVCsehk%5B/!@7afa6cadba4efb3f8494385e37090edd!TABTHREAD1?pyActivity=%40baseclass.doUIAction&action=createNewWork&className=BARC-FBU-DCDisp-Work-Claim&flowName=BeginMultipleTransactionSearch&dynamicContainerID=f9e64470-c4fa-4e63-b814-0a50f75d0647&contentID=32a4838f-4fc8-24b1-e5e8-f23bc491cdfa&tabIndex=2&prevContentID=88d0292e-17d9-4ddd-9c1a-7e474fd0068c&prevRecordkey=Data-Portal%7CpyDashboard7%7Cundefined&portalThreadName=STANDARD&portalName=DCDFOUser&pzHarnessID=HIDECAB8BB655B607F2F63774650DFD19DB’])
= count(//[@src =
'/prweb/04RbAsalj9MXSlXiS34ETTvROQXb0ZzN0FhlgVCsehk%5B
/!@7afa6cadba4efb3f8494385e37090edd!TABTHREAD1?pyActivity=%40baseclass.doUIAction&action=createNewWork&className=BARC-FBU-DCDisp-Work-Claim&flowName=BeginMultipleTransactionSearch&dynamicContainerID=f9e64470-c4fa-4e63-b814-0a50f75d0647&contentID=32a4838f-4fc8-24b1-e5e8-f23bc491cdfa&tabIndex=2&prevContentID=88d0292e-17d9-4ddd-9c1a-7e474fd0068c&prevRecordkey=Data-Portal%7CpyDashboard7%7Cundefined&portalThreadName=STANDARD&portalName=DCDFOUser&pzHarnessID=HIDECAB8BB655B607F2F63774650DFD19DB’])]’
not found)

01-30-2018 03:52:56 PM - [END] - End Test Case :
Test Cases/New Test Case

Also the object name detected by Katalon is PpyWorkPagepSortCode . But the object name used in website code is $PpyWork$PagepSortCode . Is the object not getting detected because of $ . Does katalon not detect $ ? Because it is detecting textbox in previous page but not in the current page . The previous page textBox does not have ‘$’ in it’s name . But the current textBox has $ .

Please inform how to resolve this issue.

Well your xpath is very complicated. First of all, please use 5.3 version for shorter Xpath and show me back its xpath

Hello , I am not using xpath . This is the error shown by katalon . I am only using the line.

WebUI.setText(findTestObject(‘Pega/Pega25/input_$ppy$sortCode’),‘212266’)

where object name is input_$ppy$sortCode

can you share the screenshot of testObject? so that we can dig deep into the problem.

Hi,

I am having the similar Issue as well, I am trying to set text between p tags using xpath : id(“editor_1”)/eom-content/div[@class=“xsm-doc”]/div[@class=“xsm-story”]/div[@class=“xsm-grouphead emxed-ct-headline emxed-contentitem-wrapper”]/div[@class=“xsm-headline”]/“p[@class=“xsm-p”]”,

but it is throwing exception saying that unable to set the text and is webElementNotFound exception. Can anyone pls help me on that.

Thanks

This artifact might help. It worked for me: