Cannot take screenshot during running a test case

I have the following test case,
When I run it, I always receive the follomging message
SLF4J: The requested version 1.7.16 by your slf4j binding is not compatible with [1.6]
SLF4J: See SLF4J Error Codes for further details.
2019-03-04 13:22:50.561 e[34mINFO e[0;39m e[36mc.k.katalon.core.main.TestCaseExecutor -e[0;39m e[39m--------------------e[0;39m
2019-03-04 13:22:50.566 e[34mINFO e[0;39m e[36mc.k.katalon.core.main.TestCaseExecutor -e[0;39m e[39mSTART Test Cases/testcase08e[0;39m
2019-03-04 13:22:51.233 e[39mDEBUGe[0;39m e[36mtestcase.testcase08 -e[0;39m e[39m1: setText(findTestObject(“folder08/input_ID_id”), “000422039”)e[0;39m
2019-03-04 13:22:51.630 e[31mWARN e[0;39m e[36mc.k.k.c.w.h.s.WebUIScreenCaptor -e[0;39m e[39mCannot take screenshote[0;39m
2019-03-04 13:22:51.635 e[1;31mERRORe[0;39m e[36mc.k.k.core.keyword.internal.KeywordMain -e[0;39m e[31m❌ Unable to set text ‘000422039’ of object 'Object Repository/folder08/input_ID_id’e[0;39m
2019-03-04 13:22:51.650 e[1;31mERRORe[0;39m e[36mc.k.katalon.core.main.TestCaseExecutor -e[0;39m e[31m❌ setText(findTestObject(“folder08/input_ID_id”), “000422039”) FAILED.e[0;39m
e[31mReason:e[0;39m
e[31mcom.kms.katalon.core.exception.StepFailedException: Unable to set text ‘000422039’ of object 'Object Repository/folder08/input_ID_id’e[0;39m
e[31m at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:48)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:65)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:27)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.builtin.SetTextKeyword.setText(SetTextKeyword.groovy:65)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.builtin.SetTextKeyword.execute(SetTextKeyword.groovy:37)e[0;39m
e[31m at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.setText(WebUiBuiltInKeywords.groovy:950)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$setText.call(Unknown Source)e[0;39m
e[31m at testcase08.run(testcase08:16)

I don’t see anything which says open the browser. Katalon won’t be able to guess what is the website address and there that element is?

Let me know if I am missing something.

Test Case should start like this in a happy scenario :slight_smile:

WebUI.openBrowser(‘www.google.com’) /* This will tell Katalon to Open the browser and go to Google.com

1 Like

I want to start at certain web page (URL) and I chose the active browser (fire fox). so I think there is no need to have open browser

@ahmed.saleh Where in Katalon Studio you are mentioning the certain web page (URL) ?

Every time Katalon executes a test case it starts a new session in the browser of your choice even if the there is an active session of that browser is running on your computer.

For e.g I have Google Chrome running all the time but when I execute a test case in Katalon it starts another Google Chrome session without disturbing my current session.

1 Like

Thanks a lot Manpreet,
My problem my test case always fails at the login
Here is my case

and here is my browser at the failed step

From the Katalon Studio, it looks like it is not able to found the Search Bar where you are entering the Search term because the AUT didn’t allow you to log in.

Are you able to log in manually using the same Username and Password used in this script?

Katalon will only be successful in Step 6 if Step 5 has actually passed, But in this case, login didn’t go through.

Manpreet,
My test case ran successfully if I put my password without encryption as text as shown here, but this is a risky.
I really like to fix this login i am facing. I need your help for this

I would seek help of @Brandon_Hein Can you please help. setEncryptedText is not working with Ahmed application and it is throwing error. I can’t seem to find any solution here.

Hi Manpreet, Just to let you know that I did NOT receive any thing from Brandon yet.
The encrypted password now is the only problem I am facing now. I really appreciate if you can help me on this issue.
I modifies my test case to read data from excel data file successfully

@ahmed.saleh

Please post the following information:

1.) The test code leading up to the failure when trying to login with the encrypted password (Script view, not Manual view).
2.) The full error log.

Thanks a lot Brandon.
Here is the test code
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable

WebUI.openBrowser(‘’)

WebUI.navigateToUrl(‘https://sait-sust-non-dev1-ban-idm-wso2.sait.ca/authenticationendpoint/login.do?commonAuthCallerPath=%252Fcas-web%252Flogin&forceAuth=false&passiveAuth=false&tenantDomain=carbon.super&sessionDataKey=c8a06a27-1121-4a46-b058-476797e113d3&relyingParty=BannerApplicationNavigator2&type=cassso&sp=BannerApplicationNavigator2&isSaaSApp=false&authenticators=BasicAuthenticator:LOCAL’)

WebUI.setText(findTestObject(‘Object Repository/folder01/input_User Name_username’), ‘ff_as’)

WebUI.setEncryptedText(findTestObject(‘Object Repository/folder01/input_Password_password’), ‘vhY2RXFFBgI=’)

WebUI.click(findTestObject(‘Object Repository/folder01/input_Password_btn btn-default hidden-xs’))

WebUI.setText(findTestObject(‘Object Repository/folder01/input_Welcome_search’), ‘apacons’)

WebUI.sendKeys(findTestObject(‘Object Repository/folder01/input_Welcome_search’), Keys.chord(Keys.ENTER))

WebUI.click(findTestObject(‘Object Repository/folder01/i_Application Navigator Keyboard Shortcuts_fa fa-lock fa-lg fa-fw fa-flip-horizontal’))

==================================
and here is the error log
03-06-2019 04:22:38 PM Test Cases/testcase01

Elapsed time: 37.733s

Test Cases/testcase01 FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to set text ‘apacons’ of object ‘Object Repository/folder01/input_Welcome_search’
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:48)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:65)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:27)
at com.kms.katalon.core.webui.keyword.builtin.SetTextKeyword.setText(SetTextKeyword.groovy:65)
at com.kms.katalon.core.webui.keyword.builtin.SetTextKeyword.execute(SetTextKeyword.groovy:37)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.setText(WebUiBuiltInKeywords.groovy:950)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$setText$1.call(Unknown Source)
at testcase01.run(testcase01:26)
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:331)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:322)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:301)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:293)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:227)
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 TempTestCase1551914555651.run(TempTestCase1551914555651.groovy:21)

====================

and here is the screenshot
image

Can you try using sendKeys() instead of setText()? So instead of:

WebUI.setText(findTestObject(‘Object Repository/folder01/input_Welcome_search’), ‘apacons’)

Try:

WebUI.sendKeys(findTestObject(‘Object Repository/folder01/input_Welcome_search’), ‘apacons’)

I used sendKeys() instead of setText() as shown below, and I get the same error

Looking at the error message in the log view (not in the console), it looks like the xpath you are using isn’t finding any elements in the DOM:

//input[@id='search-landing']

Can you give a screenshot of the HTML element you are trying to send keys to?

Brandon,
the first step in my test is to login using the following form

if the login successes then it will go to another form to enter the test apacons which display the ID

My problem is the login always fails so the following step fails due to the statement
WebUI.setEncryptedText(findTestObject(‘Object Repository/folder01/input_Password_password’), ‘vhY2RXFFBgI=’)

According to your log viewer though, the setEncryptedText() step passed without an issue:

image

Which means that, as far as the script is concerned, this text was entered. What happens in real-time when you run the script? Does the password field remain blank? Does some value get entered, but you still get the “Authentication Error” message?

You are absolutely right. But the login failed, which means either user name is wrong, or password is wrong or both of them are wrong.

if I use the following statement:
WebUI.setText(findTestObject(‘folder01/input_Password_password’), ‘158503’)

Instead of
WebUI.setEncryptedText(findTestObject(‘Object Repository/folder01/input_Password_password’), ‘vhY2RXFFBgI=’)

this is shown before to Manpreet

Yep I saw that, but again, what happens in the Password field in real-time when you run the script? An easy way to test this is to put a breakpoint at the line of code that clicks the login button:

Then run your script in Debug mode so that it pauses before trying to actually login.

Is the password field blank? Is a value entered into the field? If there is a value, and if you manually click “Sign In”, does it work?

While the recording time, I enter my user and password and it goes successfully without any problem so I assume during the run time (replay it) Katalon uses whatever entered during the recording.
Why the login failed during the run time but not failed during the recording time.

How to add breakpoint at the line of code that click the login button?

This is a dangerous assumption. Record and playback is, and always has been, very very flaky.

Double click in the vertical blue bar for the line of code I pointed out in the above screenshot. Debug mode is extremely useful for isolating issues like this. Please give this article a read:

https://docs.katalon.com/katalon-studio/tutorials/debugging_test_case.html