Query Element States
Check visibility, enabled/disabled state, editability, viewport position, and more with a simple, intuitive API.
A powerful TypeScript library for querying and waiting for element states in the browser
import { ElementStateInspector } from 'acquiescence';
const inspector = new ElementStateInspector();
const button = document.querySelector('#submit-button');
// Check if an element is visible and enabled
const result = await inspector.queryElementStates(button, ['visible', 'enabled']);
if (result.status === 'success') {
console.log('Button is ready!');
} else {
console.log(`Button is ${result.missingState}`);
}
// Wait for an element to be ready for interaction
try {
const hitPoint = await inspector.waitForInteractionReady(
button,
'click',
5000 // 5 second timeout
);
console.log(`Element ready at point (${hitPoint.x}, ${hitPoint.y})`);
} catch (error) {
console.error('Element not ready within timeout');
}Modern web applications are dynamic and complex. Elements appear, disappear, move around, and change state constantly. Acquiescence provides a robust way to:
Perfect for:
npm install acquiescenceyarn add acquiescencepnpm add acquiescence