feat: use selectors as per getList value
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
|||||||
getElementInformation,
|
getElementInformation,
|
||||||
getRect,
|
getRect,
|
||||||
getSelectors,
|
getSelectors,
|
||||||
|
getNonUniqueSelectors,
|
||||||
isRuleOvershadowing,
|
isRuleOvershadowing,
|
||||||
selectorAlreadyInWorkflow
|
selectorAlreadyInWorkflow
|
||||||
} from "../selector";
|
} from "../selector";
|
||||||
@@ -457,15 +458,22 @@ export class WorkflowGenerator {
|
|||||||
* @private
|
* @private
|
||||||
* @returns {Promise<string|null>}
|
* @returns {Promise<string|null>}
|
||||||
*/
|
*/
|
||||||
private generateSelector = async (page: Page, coordinates: Coordinates, action: ActionType) => {
|
private generateSelector = async (page: Page, coordinates: Coordinates, action: ActionType, getList: boolean) => {
|
||||||
const elementInfo = await getElementInformation(page, coordinates);
|
const elementInfo = await getElementInformation(page, coordinates);
|
||||||
|
const selectorInfo = await getNonUniqueSelectors(page, coordinates);
|
||||||
|
|
||||||
|
const selectorBasedOnCustomAction = (getList === true)
|
||||||
|
? await getNonUniqueSelectors(page, coordinates)
|
||||||
|
: await getSelectors(page, coordinates);
|
||||||
|
|
||||||
|
console.log('Selector Info:', selectorInfo);
|
||||||
const bestSelector = getBestSelectorForAction(
|
const bestSelector = getBestSelectorForAction(
|
||||||
{
|
{
|
||||||
type: action,
|
type: action,
|
||||||
tagName: elementInfo?.tagName as TagName || '',
|
tagName: elementInfo?.tagName as TagName || '',
|
||||||
inputType: undefined,
|
inputType: undefined,
|
||||||
value: undefined,
|
value: undefined,
|
||||||
selectors: await getSelectors(page, coordinates) || {},
|
selectors: selectorBasedOnCustomAction || {},
|
||||||
timestamp: 0,
|
timestamp: 0,
|
||||||
isPassword: false,
|
isPassword: false,
|
||||||
hasOnlyText: elementInfo?.hasOnlyText || false,
|
hasOnlyText: elementInfo?.hasOnlyText || false,
|
||||||
|
|||||||
Reference in New Issue
Block a user