Hi ,
Please help in verifying text present for description of each element displayed in UI
like
item1-- description text
item2 --description text
item3 – description text
Description may be same text for items. if i use verify text present it is verifying in page source not for each element.
Thanks in Advance
Hi,
Thank you for your reply. i have tried ‘VerifyElementText’ which is only checking the exact text of the element not the description inside.
And i need to check with partial text like
Assert.assertTrue(Message.getText().contains(“successfully processed”));
Thanks for your support.
Please try using ‘Verify Element Text’ in this case to verify each element description.
Hi @sitapadmam .
I had the same problem to check if a part of a string contains another one.
what I did is to go on
KEYWORDS - NEW PACKAGE and define one [ mine is specialPack ]
KEYWORDS - NEW KEYWORD and then create a new keyword [ mine is checkIfContains ]
The code is: [ ** ** used to comment or to use your own code ]
package specialPack
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.annotation.Keyword
import com.kms.katalon.core.checkpoint.Checkpoint
import com.kms.katalon.core.checkpoint.CheckpointFactory
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testcase.TestCase
import com.kms.katalon.core.testcase.TestCaseFactory
import com.kms.katalon.core.testdata.TestData
import com.kms.katalon.core.testdata.TestDataFactory
import com.kms.katalon.core.testobject.ObjectRepository
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords
import internal.GlobalVariable
import MobileBuiltInKeywords as Mobile
import WSBuiltInKeywords as WS
import WebUiBuiltInKeywords as WebUI
public class checkIfcContains {
@Keyword **--> definition of the keyword you will recall**
def checkIfContains(String extString, String intString) {
if (extString.toLowerCase().contains(intString.toLowerCase())) {
**DO WHATEVER YOU NEED TO BE DONE**
}
else
{
**DO WHATEVER YOU NEED TO BE DONE ELSE**
}
}
}
Then when you are creating your manual test, go to +Add dropdown menu and you will find your Custom Keyword to use, as you will find it in the Keyword Browser.
Hope it helps.
Carlo