feat: date input check using element information

This commit is contained in:
RohitR311
2024-12-19 12:13:17 +05:30
parent 2e30192422
commit 14079fa0f8

View File

@@ -286,11 +286,11 @@ export class WorkflowGenerator {
const selector = await this.generateSelector(page, coordinates, ActionType.Click);
logger.log('debug', `Element's selector: ${selector}`);
const elementInfo = await getElementInformation(page, coordinates, '', false);
console.log("Element info: ", elementInfo);
// Check if clicked element is a date input
const isDateInput = await page.evaluate(({x, y}) => {
const element = document.elementFromPoint(x, y);
return element instanceof HTMLInputElement && element.type === 'date';
}, coordinates);
const isDateInput = elementInfo?.tagName === 'INPUT' && elementInfo?.attributes?.type === 'date';
if (isDateInput) {
// Notify client to show datepicker overlay