Hoping you can help - I am new to Katalon and still learning the ropes.
I need to be able to add a prompt, for user input, into a Web UI script.
The value entered into the prompt by the user running the script at runtime, then needs to be stored into a variable, that I can use within the script at a later point (SetText in a field).
The variable is called “MFACode”
Please can you help? Is this possible and if so, what is the code to achieve this?
I appreciate your quick response. Here is my scenario to give some context,which is to test a login process with multi-factor authentication
1). Login to web site using Username and password chars x, y and z as requested
2). A randomly generated code is sent to a registered mobile phone as SMS (“MFACode”)
3). User needs to enter code to complete login process
Open to suggestions as to how Katalon studio could support this!
Should be easy enough to do. Register username and password object and use setText().
Many possibilities for this. I think it should be done server side to bypass the generated code during automated testing. It’s similar to the captcha plugin.
However, if there’s a way to access your MFACode from another website (so you could navigate there and get it) or someway to write your MFACode in a texte file or a database, you can then read the file and write the code.
Basically Katalon Studio is limited to what you can develop. In my applications, things like 2FA, passwords, captcha are removed in testing environment.
My suggestion would be to put in a 15 second delay, WebUI.delay(15), (you may have to play with the timing) in which you have your time to enter your “code”. I’m assuming the text you’re trying to enter cannot be done by a WebUI.setText().
Another idea would be to do your testing in parts and prepare a spreadsheet or text file with your code. Then you can read in the spreadsheet or text data. Information on how to do that is in this forum.
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 static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject 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.testng.keyword.TestNGBuiltinKeywords as TestNGKW 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 com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows import internal.GlobalVariable as GlobalVariable import org.openqa.selenium.Keys as Keys
If you are starting at the very beginning, I would suggest viewing some of the multitude of videos on KS. They can provide more information than I via chat sessions. As for your UID and PWD, you have them identified in your code–MyUID and MyPWD–so I’m not sure about your question? (For testing, maybe you can hard-code something that has “Testing” access.)
If you need a break in your code, then I have used just a “delay” to give me the moment to enter in my code, such as your RSA SecurID. However, you may not need that if you go with providing a correct username and password since it seems you have options.
Note: if you are using the Web Spy, you need to ensure you have the correct element in contact with the Spy and not just “close enough”.
Also note: don’t put anything in this forum that is confidential or proprietary. You can always fudge and edit the script to simplify, like “myPage/idnosc_863b27”. Takes a bit more time, but keeps the confidentiality.