feat: add datetime-local selection pair to workflow
This commit is contained in:
@@ -315,6 +315,26 @@ export class WorkflowGenerator {
|
|||||||
await this.addPairToWorkflowAndNotifyClient(pair, page);
|
await this.addPairToWorkflowAndNotifyClient(pair, page);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public onDateTimeLocalSelection = async (page: Page, data: { selector: string, value: string }) => {
|
||||||
|
const { selector, value } = data;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await page.fill(selector, value);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Failed to fill datetime-local value:", error);
|
||||||
|
}
|
||||||
|
|
||||||
|
const pair: WhereWhatPair = {
|
||||||
|
where: { url: this.getBestUrl(page.url()) },
|
||||||
|
what: [{
|
||||||
|
action: 'fill',
|
||||||
|
args: [selector, value],
|
||||||
|
}],
|
||||||
|
};
|
||||||
|
|
||||||
|
await this.addPairToWorkflowAndNotifyClient(pair, page);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a pair for the click event.
|
* Generates a pair for the click event.
|
||||||
* @param coordinates The coordinates of the click event.
|
* @param coordinates The coordinates of the click event.
|
||||||
@@ -390,6 +410,16 @@ export class WorkflowGenerator {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isDateTimeLocal = elementInfo?.tagName === 'INPUT' && elementInfo?.attributes?.type === 'datetime-local';
|
||||||
|
|
||||||
|
if (isDateTimeLocal) {
|
||||||
|
this.socket.emit('showDateTimePicker', {
|
||||||
|
coordinates,
|
||||||
|
selector
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//const element = await getElementMouseIsOver(page, coordinates);
|
//const element = await getElementMouseIsOver(page, coordinates);
|
||||||
//logger.log('debug', `Element: ${JSON.stringify(element, null, 2)}`);
|
//logger.log('debug', `Element: ${JSON.stringify(element, null, 2)}`);
|
||||||
if (selector) {
|
if (selector) {
|
||||||
|
|||||||
Reference in New Issue
Block a user