Hello all.
Could you try this problem and post the solution?

Sort the number from 1 to 9. Click on ‘Swap’, if the left number is greater than the right number inside the blue bubble. Otherwise click ‘Next’. The blue text field on the bottom left will display “KEEP SORTING” until the numbers are correctly sorted.

// Assuming ‘numbers’ is an array containing the numbers 5, 6, 9, 7, 4, 1, 3, 2, 8
numbers = {5, 6, 9, 7, 4, 1, 3, 2, 8}
n = numbers.Length

// Perform Bubble Sort
for i = 0 to n-1
for j = 0 to n-i-2
// Use UI Automation activities to get the value of current and next number
current = Get Text from current blue bubble
next = Get Text from next blue bubble

if current > next
// Click 'Swap' button
Click 'Swap' button using UI Automation
else
// Click 'Next' button
Click 'Next' button using UI Automation
endif
endfor

endfor

// At this point, the numbers should be sorted

note:
The problem you’ve described seems to be a classic bubble sort algorithm implemented through a user interface where you have the options to ‘Swap’ if the current number is greater than the next, or to ‘Next’ if the current number is less than or equal to the next. The goal is to sort the numbers from 1 to 9 in ascending order.

Add the necessary activities to the workflow as described below:

a. Assign Activities: Create variables to store the numbers to be sorted and the index of the current iteration.

b. While Loop: Use a While loop to continue sorting until the numbers are correctly sorted.

c. If Activity: Inside the While loop, use an If activity to compare the left number with the right number inside the blue bubble. If the left number is greater than the right number, click on ‘Swap’. Otherwise, click on ‘Next’.

d. Click Activities: Use Click activities to perform the ‘Swap’ and ‘Next’ actions.

e. Element Exists Activity: Use an Element Exists activity to check if the blue text field displays “KEEP SORTING”. If it does, continue with the next iteration of the loop. If not, exit the loop.

Configure the activities and properties according to the logic described in the problem statement.

Test the workflow to ensure that it correctly sorts the numbers from 1 to 9.

Sequence
Attach Browser
Open Browser
Do While
If
Then
Click (To perform ‘Swap’ or ‘Next’ action)
Then
If
Element Exists (To check if “KEEP SORTING” is displayed)
Do While
Sequence

I’m totally against spoon feeding but sharing the code which I tried as an interest in challenge. The solutions provided by other community members should be helpful to you to design this.