Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to perform the action chain.
Selenium Java
Actions actions = new Actions(driver);
actions.moveToElement(element).[1](); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using build() without perform() does not execute the actions.
Using click() or sendKeys() directly without perform() will cause errors.
✗ Incorrect
The perform() method executes the action chain built so far.
2fill in blank
mediumComplete the code to build and perform the action chain.
Selenium Java
Actions actions = new Actions(driver);
actions.click(element).[1](); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Calling perform() directly without build() when multiple actions are chained.
Using sendKeys() or release() incorrectly here.
✗ Incorrect
The build() method compiles all actions into a single composite action.
3fill in blank
hardFix the error in the code to correctly perform the action chain.
Selenium Java
Actions actions = new Actions(driver);
actions.moveToElement(element).click().[1](); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Calling build() without perform() means actions are not executed.
Using sendKeys() or release() here is incorrect.
✗ Incorrect
After building the action chain, perform() must be called to execute it.
4fill in blank
hardFill both blanks to build and perform a double click action.
Selenium Java
Actions actions = new Actions(driver); actions.doubleClick(element).[1]().[2]();
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Calling perform() before build() causes errors.
Using release() or sendKeys() here is incorrect.
✗ Incorrect
First, build() compiles the action, then perform() executes it.
5fill in blank
hardFill all three blanks to build and perform a drag and drop action.
Selenium Java
Actions actions = new Actions(driver); actions.clickAndHold(source).moveToElement(target).[1]().[2]().[3]();
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to release the mouse button causes the drag to fail.
Calling perform() before build() causes errors.
✗ Incorrect
The sequence is: release() to drop, build() to compile, and perform() to execute.