How To Handle Slider and Find Text

Hello Everyone I Want to ask how to handle slider carrousel on web to clicking but stopping when the text is already found, for the web like this


Thank You for the help

How about a “while” loop and a WebUI.verifyTextPresent("yourText", false) as a condition to stop the “while” loop? I would also insert a counter for your trial runs to ensure you do not get into an infinite loop as a safety measure.
Edit: I had to change the verifyTextPresent to use Regular Expression to make the match in my testing.

boolean hasFound = false;
int testValue = 0;
def str = "yourText";

while (!hasFound) {
    if (WebUI.verifyTextPresent(".*${str}.*", true, FailureHandling.OPTIONAL)) {
        hasFound = true;
    }

    if (testValue >= 8) {
         // have this as a safety measure
        hasFound = true;
    }
    testValue += 1;
    WebUI.waitForElementClickable(findTestObject("righthand arrow element"), 10)
    WebUI.click(findTestObject("righthand arrow element"))
    WebUI.delay(1)
}
Or maybe:

If the text is “present” within the slider without being in the viewport, then the above idea would not work. The below idea creates an element of the text you are looking for and then checks if the element is visible.

import com.kms.katalon.core.testobject.ConditionType

TestObject tArrow = new TestObject()
tArrow.addProperty("xpath", ConditionType.EQUALS, '//div[@class="arrow-paginate right-arrow specials-right-arrow"]')

TestObject tObj = new TestObject()
tObj.addProperty("text", ConditionType.CONTAINS, "YourText")
//tObj.addProperty("xpath", ConditionType.EQUALS, '//*[contains(text(), "your text")]')

boolean hasFound = false;
int testValue = 0;

while (!hasFound) {
    if (WebUI.verifyElementVisible(tObj, FailureHandling.OPTIONAL) {
        hasFound = true;
    }

    if (testValue >= 8) {
         // have this as a safety measure
        hasFound = true;
    }
    testValue += 1;
    WebUI.waitForElementClickable(tArrow, 10)
    WebUI.click(tArrow)
    WebUI.delay(1)
}