Element Interaction
What you can actually do to an element once you hold it: click it, type into it, read its state, drive it with low-level input, and read the exception when the command cannot land.
on this pageshowhide
explore
- Core Input Commands15 questions
- Clicking and Typing5 questions
- State and Attribute Reads5 questions
- Dropdown Support Class5 questions
- Low-Level Input12 questions
- Pointer and Key Sequences4 questions
- Script Injection Escape Hatch4 questions
- Uploading Local Files4 questions
- Command Failure Signals9 questions
- Stale Reference Errors5 questions
- Intercepted and Hidden Targets4 questions
questions
page 2 of 2In Selenium, why does a loop over a cached List of WebElement rows start failing part-way through?
basics
~20 sThe list is a snapshot of references captured at one instant, not a live view. If the loop body changes the page, the rows it replaces are detached and every remaining handle in the list is dead.
Your Selenium upload tests must run against a local browser and a remote browser with its own filesystem - how would you design for both?
basics
~20 sHold one invariant: the file must exist where the browser can read it. Keep the test bodies identical, and put the difference in session creation, where a remote driver gets a LocalFileDetector and a local driver keeps the default.
In Selenium, how do Actions.scrollToElement() and Actions.scrollByAmount() differ, and which device do they drive?
basics
~20 sBoth drive Selenium's virtual wheel device, added in Selenium 4.2. scrollToElement takes an element and scrolls it into view, letting the driver work out the distance; scrollByAmount takes pixel deltas from the viewport's top left corner.
In Selenium, what does the strictFileInteractability capability change for a hidden input type=file?
basics
~20 sIt turns the interactability checks back on for file inputs. Selenium 4 defaults it to false, so a path can be sent to a hidden file input; set it to true and that same element is rejected as not interactable.
In Selenium, how does a script run by executeAsyncScript signal completion, and what happens if it never signals?
basics
~20 sSelenium appends a callback as the script's last argument, so the script calls arguments[arguments.length - 1] with its result. If it never calls back, the command blocks until the script timeout elapses and then throws ScriptTimeoutException.
What does Selenium's WebElement.getAriaRole() return, and how does it differ from reading the role attribute?
basics
~20 sIt returns the WAI-ARIA role the browser computed for the element, including the implicit role of the tag. Reading the role attribute returns only the literal token the markup declared, or nothing when the markup declared none.
showing 31–36 of 36