Playwright + Java · Lesson 4 of 38
Module 4: Arrays
Your task
Implement verifyMenuItems:
Write it in the editor, then press Check answer (Ctrl + Enter).
import java.util.Arrays;
// Single-dimensional array:
String[] expectedTabs = {"Home", "Courses", "Practice", "Profile"};
// Iteration:
for (int i = 0; i < expectedTabs.length; i++) {
System.out.println("Checking tab: " + expectedTabs[i]);
}
// Sorting and searching:
int[] responseTimes = {450, 120, 890, 230};
Arrays.sort(responseTimes); // [120, 230, 450, 890]
int minTime = responseTimes[0];In automated testing, arrays represent fixed lists of test inputs, user roles, and expected menu items. In this lesson, we cover single and multi-dimensional arrays, traversal, and the java.util.Arrays utility class. Let's master arrays!
Part of the Playwright + Java course (Playwright with Java). Practice this concept live in the Playwright Online Compiler or explore our free automation practice form.
Arrays in Java inherit Object.equals, which compares references. Use Arrays.equals(arr1, arr2) to compare element contents.
Ready? Solve the task in the editor
Use Check answer to mark it complete. Hints are there if you need them.
___