ff-automationv2 2.2.35 → 2.2.36-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/ai/llmcalls/llmAction.js +6 -5
  2. package/dist/ai/llmprompts/llmPromptTypes/systemPromptTypes.d.ts +3 -0
  3. package/dist/ai/llmprompts/promptRegistry.js +4 -0
  4. package/dist/ai/llmprompts/systemPrompts/actionExtractorPrompt.js +133 -133
  5. package/dist/ai/llmprompts/systemPrompts/arithmeticPrompt.js +40 -40
  6. package/dist/ai/llmprompts/systemPrompts/fileVerifyActionExtractorPrompt.js +36 -36
  7. package/dist/ai/llmprompts/systemPrompts/fireflinkElementIndexExtractor_Mob.js +4 -4
  8. package/dist/ai/llmprompts/systemPrompts/getActionExtractorPrompt.js +51 -51
  9. package/dist/ai/llmprompts/systemPrompts/inputContextPrompt.js +49 -49
  10. package/dist/ai/llmprompts/systemPrompts/mobileKeywordExtractor.js +86 -86
  11. package/dist/ai/llmprompts/systemPrompts/multichannelKeywordExtractor.js +47 -47
  12. package/dist/ai/llmprompts/systemPrompts/otpExtractorPrompt.js +16 -16
  13. package/dist/ai/llmprompts/systemPrompts/sliderSwipeVisionPrompt.d.ts +2 -0
  14. package/dist/ai/llmprompts/systemPrompts/sliderSwipeVisionPrompt.js +54 -0
  15. package/dist/ai/llmprompts/systemPrompts/verifyActionExtractorPromptMob.js +43 -43
  16. package/dist/ai/llmprompts/userPrompts/userPrompt.js +21 -0
  17. package/dist/automation/actions/executor.d.ts +1 -0
  18. package/dist/automation/actions/executor.js +23 -0
  19. package/dist/automation/actions/interaction/swipe/slider_Swipe.d.ts +2 -0
  20. package/dist/automation/actions/interaction/swipe/slider_Swipe.js +129 -0
  21. package/dist/automation/actions/interface/FireFlinkResponseSchema.d.ts +6 -0
  22. package/dist/automation/actions/interface/FireFlinkResponseSchema.js +8 -1
  23. package/dist/automation/actions/interface/swipeActionInterface.d.ts +15 -0
  24. package/dist/core/helpers/mobileSwipeHelper.d.ts +3 -0
  25. package/dist/core/helpers/mobileSwipeHelper.js +78 -0
  26. package/dist/core/helpers/visionFallbackHandler.js +5 -3
  27. package/dist/core/interfaces/actionInterface.d.ts +1 -0
  28. package/dist/core/interfaces/mobileSwipeSliderInterface.d.ts +25 -0
  29. package/dist/core/interfaces/mobileSwipeSliderInterface.js +2 -0
  30. package/dist/core/interfaces/promptInterface.d.ts +4 -0
  31. package/dist/core/main/actionHandlerFactory.js +2 -2
  32. package/dist/core/main/runAutomationScript.js +44 -1
  33. package/dist/core/types/promptType.d.ts +1 -0
  34. package/dist/core/types/promptType.js +1 -0
  35. package/dist/domAnalysis/searchBest.js +0 -1
  36. package/dist/utils/DomExtraction/jsForAttributeInjection.js +232 -232
  37. package/dist/utils/helpers/xpathcreation.js +18 -2
  38. package/package.json +91 -91
  39. package/dist/tests/Framework.d.ts +0 -0
  40. package/dist/tests/Framework.js +0 -62
  41. package/dist/tests/itertaion.d.ts +0 -1
  42. package/dist/tests/itertaion.js +0 -43
  43. package/dist/tests/multiBrowser.d.ts +0 -1
  44. package/dist/tests/multiBrowser.js +0 -34
  45. package/dist/tests/poc.d.ts +0 -0
  46. package/dist/tests/poc.js +0 -212
  47. package/dist/tests/senario.d.ts +0 -0
  48. package/dist/tests/senario.js +0 -1120
  49. package/dist/tests/start_iteration_suggestion.d.ts +0 -6
  50. package/dist/tests/start_iteration_suggestion.js +0 -46
  51. package/dist/tests/test.d.ts +0 -1
  52. package/dist/tests/test.js +0 -26
  53. package/dist/tests/test1.d.ts +0 -1
  54. package/dist/tests/test1.js +0 -30
  55. package/dist/tests/test12.d.ts +0 -1
  56. package/dist/tests/test12.js +0 -35
  57. package/dist/tests/test254.d.ts +0 -0
  58. package/dist/tests/test254.js +0 -87
  59. package/dist/tests/test3.d.ts +0 -1
  60. package/dist/tests/test3.js +0 -27
  61. package/dist/tests/testkaf.d.ts +0 -0
  62. package/dist/tests/testkaf.js +0 -52
  63. package/dist/tests/tests.data.d.ts +0 -1
  64. package/dist/tests/tests.data.js +0 -8
  65. package/dist/tests/testss.d.ts +0 -1
  66. package/dist/tests/testss.js +0 -23
  67. package/dist/tests/testwe.d.ts +0 -1
  68. package/dist/tests/testwe.js +0 -24
@@ -31,8 +31,9 @@ class llmAction {
31
31
  const promptBuilder = promptRegistry_js_1.prompts[platform][type];
32
32
  const systemPrompt = await promptBuilder(args);
33
33
  const userPrompt = userPrompt_js_1.userInputFormatters[type](userInput);
34
- if (type === promptType_js_1.PromptType.VISION_PROMPT && Array.isArray(userPrompt)) {
35
- return this.getLLMResponseWithVision(systemPrompt, userPrompt, isVision);
34
+ if ((type === promptType_js_1.PromptType.VISION_PROMPT || type === promptType_js_1.PromptType.SWIPE_VISION_PROMPT) && Array.isArray(userPrompt)) {
35
+ const schemaToUse = (0, FireFlinkResponseSchema_js_1.getSchemaForPrompt)(type, platform, args);
36
+ return this.getLLMResponseWithVision(systemPrompt, userPrompt, isVision, schemaToUse);
36
37
  }
37
38
  if (typeof userPrompt !== "string") {
38
39
  throw new Error("Invalid non-vision user prompt format");
@@ -116,7 +117,7 @@ class llmAction {
116
117
  }
117
118
  return this.provider;
118
119
  }
119
- async getLLMResponseWithVision(system, userPrompt, isVision = false) {
120
+ async getLLMResponseWithVision(system, userPrompt, isVision = false, schemaToUse = FireFlinkResponseSchema_js_1.VisionSchema) {
120
121
  let attempt = 0;
121
122
  const MAX_RETRIES = 5;
122
123
  let content;
@@ -149,7 +150,7 @@ class llmAction {
149
150
  { role: "user", content: parts },
150
151
  ],
151
152
  output: ai_1.Output.object({
152
- schema: FireFlinkResponseSchema_js_1.VisionSchema,
153
+ schema: schemaToUse,
153
154
  }),
154
155
  providerOptions: this.getProviderOptions()
155
156
  });
@@ -167,7 +168,7 @@ class llmAction {
167
168
  logData_js_1.logger.error(`Vision LLM Error Attempt ${attempt}:`, error);
168
169
  if (ai_1.NoObjectGeneratedError.isInstance(error) && error.text) {
169
170
  try {
170
- const recovered = this.extractValidatedJson(error.text, FireFlinkResponseSchema_js_1.VisionSchema);
171
+ const recovered = this.extractValidatedJson(error.text, schemaToUse);
171
172
  logData_js_1.logger.info(`Vision LLM Attempt ${attempt} - Recovered via regex fallback:`, recovered);
172
173
  await logData_js_1.logger.info("Time taken to get LLM response (vision, recovered):", Date.now() - startTime, "ms");
173
174
  return {
@@ -29,6 +29,9 @@ export type visionPrompt = {
29
29
  export type visionPromptMobile = {
30
30
  priorAndNextSteps: string[];
31
31
  };
32
+ export type swipeVisionPrompt = {
33
+ priorAndNextSteps: string[];
34
+ };
32
35
  export type waitActionArgs = {
33
36
  extractedDomJson: string;
34
37
  priorAndNextSteps: string[];
@@ -22,6 +22,7 @@ const inputContextPrompt_js_1 = require("./systemPrompts/inputContextPrompt.js")
22
22
  const otpExtractorPrompt_js_1 = require("./systemPrompts/otpExtractorPrompt.js");
23
23
  const fileVerifyActionExtractorPrompt_js_1 = require("./systemPrompts/fileVerifyActionExtractorPrompt.js");
24
24
  const arithmeticPrompt_js_1 = require("./systemPrompts/arithmeticPrompt.js");
25
+ const sliderSwipeVisionPrompt_js_1 = require("./systemPrompts/sliderSwipeVisionPrompt.js");
25
26
  exports.prompts = {
26
27
  web: {
27
28
  userStoryToList: userStoryToListPrompt_js_1.buildStepExtractionPrompt,
@@ -31,6 +32,7 @@ exports.prompts = {
31
32
  ffInspectorNumExtractor: fireflinkElementIndexExtactors_js_1.ffInspectorNumExtractor,
32
33
  verifyActionExtractorPrompt: verifyActionExtractorPrompt_js_1.verifyActionExtractorPrompt,
33
34
  visionPrompt: visionPrompt_js_1.visionPrompt,
35
+ swipe_vision_prompt: sliderSwipeVisionPrompt_js_1.swipeVisionPrompt,
34
36
  getActionExtractorPrompt: getActionExtractorPrompt_js_1.getActionExtractorPrompt,
35
37
  combinedActionExtractorPrompt: combinedActionExtractorPromptMob_js_1.combinedActionExtractorPromptMob,
36
38
  waitActionExtractorPrompt: waitActionExtractorPrompt_js_1.waitActionExtractorPrompt,
@@ -47,6 +49,7 @@ exports.prompts = {
47
49
  ffInspectorNumExtractor: fireflinkElementIndexExtractor_Mob_js_1.ffInspectorNumExtractorMob,
48
50
  verifyActionExtractorPrompt: verifyActionExtractorPromptMob_js_1.verifyActionExtractorPromptMob,
49
51
  visionPrompt: visionPromptMobile_js_1.visionPromptMobile,
52
+ swipe_vision_prompt: sliderSwipeVisionPrompt_js_1.swipeVisionPrompt,
50
53
  getActionExtractorPrompt: getActionExtractorPromptMob_js_1.getActionExtractorPromptMob,
51
54
  combinedActionExtractorPrompt: combinedActionExtractorPromptMob_js_1.combinedActionExtractorPromptMob,
52
55
  waitActionExtractorPrompt: waitActionExtractorPromptMob_js_1.waitActionExtractorPromptMob,
@@ -63,6 +66,7 @@ exports.prompts = {
63
66
  ffInspectorNumExtractor: fireflinkElementIndexExtractor_Mob_js_1.ffInspectorNumExtractorMob,
64
67
  verifyActionExtractorPrompt: verifyActionExtractorPromptMob_js_1.verifyActionExtractorPromptMob,
65
68
  visionPrompt: visionPromptMobile_js_1.visionPromptMobile,
69
+ swipe_vision_prompt: sliderSwipeVisionPrompt_js_1.swipeVisionPrompt,
66
70
  getActionExtractorPrompt: getActionExtractorPromptMob_js_1.getActionExtractorPromptMob,
67
71
  combinedActionExtractorPrompt: combinedActionExtractorPromptMob_js_1.combinedActionExtractorPromptMob,
68
72
  waitActionExtractorPrompt: waitActionExtractorPromptMob_js_1.waitActionExtractorPromptMob,
@@ -3,139 +3,139 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.keywordExtractor = keywordExtractor;
4
4
  async function keywordExtractor({ priorAndNextSteps }) {
5
5
  const allowedActions = ["enter", "refresh", "wait", "verify", "scroll", "navigate", "navigateBack", "click", "maximize", "minimize", "get", "upload", "close", "open", "drag_and_drop", "switch", "cleartext", "notwebopenaction", "mouseAction", "switchToAndroid", "getOtp", "arithmetic"];
6
- const prompt = `
7
- You are an expert in Web application testing.
8
- From the step, extract ONLY the meaningful keywords so that i can search for the element in the dom.
9
- Rules:
10
- - Only give response for the current step.
11
- - understand the step and context from the ${JSON.stringify(priorAndNextSteps)}.and keywords should be from step. it should not be related to other steps.
12
- - Keywords must represent ONLY the element label or visible text, never add action or instruction words in keywords.
13
- - Element name + type keywords: strip action words, leaving the core element name and any
14
- type word(s) attached to it (icon, button, dropdown, filter, tab, field, etc., in the order
15
- they appear in the step). Build keywords as a growing chain starting from the core name and
16
- adding one more type word each time: [name], [name+type1], [name+type1+type2], ...
17
- The core name alone is ALWAYS keyword 1 — never drop it, no matter how many type words follow.
18
- Treat "input field", "text field", "search box", "check box", "dropdown" as ONE type word,
19
- not two.
20
- No type word in the step → only [name] as the keyword.
21
- Example: "click X filter dropdown" → ["X", "X filter", "X filter dropdown"]
22
- If more than 3 type words are attached to the element (chain would exceed 5 keywords), keep the core name plus only the 2-3 type words CLOSEST to the element name and drop the rest, so total keywords stay within the 3-5 max.
23
- - When a step contains two elements connected by a positional or relational phrase, keywords MUST contain at least one keyword from each element — TARGET element first, then the reference element. Never omit the reference element. This includes positional connectors (above, below, next to, under, near) AND possessive/associative connectors (of, for) that link an attribute/property element to a named reference element. Do NOT merge the two elements into a single combined keyword string.
24
- Example: "Click on x above y" → x is the target, y is the reference → ["x", "y"].
25
- Example: "get Price of Learn Selenium" → Price is the target attribute, "Learn Selenium" is the reference element → keywords ["Price", "Learn Selenium"], elementName "Price".
26
- Example: "verify Rating for Learn Selenium is 300" → ["Rating", "Learn Selenium"], elementName "Rating".
27
- - 3 to 5 keywords maximum. dont give more then 5 keywords. and no need for case sensitive.
28
- - General ordering rule: whenever a step involves both a target element and a reference/context element, the TARGET element's keyword(s) must always come FIRST, followed by the reference/context element's keyword(s). This applies to positional/relational steps, selection steps, and any other multi-element step.
29
- - For the open action if they are not provided anything like profile, capablities in the step in that case don't add them check whether the profile and the capablities are present in the step if not please don't add them.
30
- - For the Open action, if a browser path and profile are provided, return keywords as ["path:<path_value>", "profile:<profile_value>"]. Should not remove backslash from path.
31
- example: step open browser,x:\\x\\x\\x,default -> ["path:c:\\x\\x\\x","profile:default"]
32
- - For the Open action, if the user requests specific browser capabilities/arguments, extract them into the keywords array using the "caps:" prefix followed by one of these exact allowed values:
33
- - "headless" (for running in headless / no-gui mode)
34
- - "incognito" (for private / incognito mode)
35
- - "ignoreCertificates" (for ignoring SSL/certificate errors)
36
- - "startMaximized" (for starting maximized)
37
- - "disableGpu" (for disabling hardware/GPU acceleration)
38
- - "disableNotifications" (for blocking push notifications)
39
- - "disableExtensions" (for disabling browser extensions)
40
- - "disablePopups" (for disabling popup blocking)
41
- - "muteAudio" (for muting browser audio)
42
- - "noSandbox" (for disabling sandbox)
43
- - "disableWebSecurity" (for disabling web security, CORS, or same-origin policy checks)
44
- - "disableLocalNetwork" (for disabling WebRTC local IP discovery or local network access constraints)
45
- - "geolocation" (for blocking or allowing geolocation access)
46
- - "camera" (for blocking or allowing camera access)
47
- - "microphone" (for blocking or allowing microphone access)
48
- - "passwordManager" (for disabling credentials and password manager prompts)
49
- Do NOT extract or generate any capability strings outside of this list.
50
- - Do NOT split the keyword into individual words or generate variations such as ["sign", "in"] or ["add", "to", "cart"] for ["Sign In","Add to Cart"]. Only include the original phrase should not add type for first keyword.
51
- - If the step is about selecting/choosing/picking a SINGLE element with no separate reference element present (e.g. "select the Agree checkbox", "select India"), treat it as ONE step: keywords = [target element] only, action = "click".
52
- - If the step is about entering text or Uploading file, Should NOT include input value from the step into keywords.
53
- - If the step has words like tag name audio, video, image,svg, checkbox etc, include them in the keywords.
54
- - **If icon is mentioned in step then 'svg' should add in keywords ex: click on x icon -> [x, x icon,svg] and for Upload action first keyword should be 'file'. ex: upload file in x -> [file,x].**
55
- - Do NOT split single-word keywords and do NOT include relation terms (above, below, next to, of, for, etc.) in keywords.
56
- - Treat each keyword independently never merge different keywords.
57
- - Keywords can be string or number if the step contains a number as part of the ELEMENT's name/label (e.g. "click on Step 2 tab" -> "Step 2" is a keyword). This does NOT apply to numbers that are the value being entered/typed/uploaded — those stay excluded per the "entering text or Uploading file" rule below, even if numeric (e.g. "Enter 5 in Quantity field" -> "5" is NOT a keyword).
58
- - Do Not include any other unrelated keywords for step.
59
- - Do NOT include generic UI words (button, field, etc) and action words (tap, click, press, etc).
60
- - Do NOT include status/technical words (displayed, enabled, authenticate, visible).
61
- - If the step is for the switching to android then provide the action as the switchToAndroid
62
- - element_name: extract name of the element that mentioned in the the step.(eg:tap on x -> element_name:x) keep element_name as short as possible and make the first letter of first word of the element_name as capital. because element_name is also used to find element in the dom. and if element_name is not mentioned in step then return action of the step as element_name.
63
- - Set action to notwebopenaction only when the instruction is related to a mobile application, app, application, installed package, or bundle .
64
- - action: click for taping, clicking or selecting, enter for entering input, wait for waiting or sleeping,scroll for scrolling and swiping, navigate for navigating to page using url, navigateBack for navigateing back to previous page, get for getting,fetching,capturing,reading element or text,maximize for maximizing browser window, close for closing browser window,open for opening browser window, upload for uploading file using path, drag_and_drop for dragging and dropping element, switch is for switching to tab or window or frame,cleartext for clearing or removing text from element, mouseAction for the action related mouse actions even for mouse click , refresh is for refreshing or reloading pages, getOtp for fetching/reading an OTP value, arithmetic for performing arithmetic operations (multiply, divide, add, subtract, calculate).
65
- - If mouse action related step is there select mouseAction from the allowed actions list check for the step and provide it.
66
- - action must be one of from this list ${JSON.stringify(allowedActions)}.if not one of them, return '0'. if step about set or find action return '0'
67
- - For navigate action, keywords should contain only one keyword which is full url from the step and should not include any other text. and if step has another actions, including navigate action, don't return navigate action return another action which is in the step. and element_name should be "URL".
68
- - Navigate action rules:
69
- - Use action "navigate" ONLY when the step gives an explicit instruction to go to a URL (e.g., "Navigate to https://x.com"). keywords must contain only the full URL, nothing else. elementName should be "URL".
70
- - If the step ONLY checks/confirms the current or already-navigated URL, with NO "go to/navigate to" instruction present in that same step (e.g., "Verify navigated URL", "Get navigated URL"), return whichever action word the step itself uses (verify, get, check, confirm, etc. — never "navigate"), and do NOT split it — it is already a single atomic step. keywords should be ["URL"], elementName "URL".
71
- CRITICAL RULES:
72
- 1.If the step contains multiple actions, you MUST split it into multiple objects in the "steps" array in the same sequence and generate the response object in the same flow.
73
- - Each object must represent EXACTLY ONE action.
74
- - Preserve the ORIGINAL ORDER of actions strictly.
75
- Example 1: "Enter username , Password as Username and Password and click on button", should be split into 3 steps: 1.Enter Username in Username, 2.Enter Password in Password, 3.Click on button. and elementName for first step should be Username, for second step should be Password and for third step should be click on button.
76
-
77
- 2.If the step contains Select, choose, pick and also contains a connecting word to a reference element ("from", "in", "on", "under") then you must always split into exactly two steps, click on the reference element first and then click on the target value. elementName for the first step should be the reference element (mentioned after the connecting word), and for the second step it should be the target value (mentioned after select/choose/pick). if the step has more than one connecting word then consider only the first one for elementName and keyword extraction.
78
- Example: "Select 'India' from Country" → 1.Click on Country, 2.Click on India. elementName for first step should be Country and for second step should be India.
79
- Example: "select 'x' in 'y'" → 1.Click on y, 2.Click on x. elementName for first step should be y and for second step should be x.
80
- 3.If the step contains a compound action (e.g., "Enter text in field and click button"), you MUST split it into separate steps for each action, ensuring that each step is represented as a distinct object in the "steps" array with its own keywords and elementName.
81
- Example: "Enter 'John' in Name field and click Submit" → 1.Enter 'John' in Name field, 2.Click on Submit. and elementName for first step should be Name field and for second step should be Submit.
82
- 4. ONLY IF the step text itself contains BOTH an explicit "go to/navigate to URL" instruction AND a separate URL-checking instruction (e.g., "Navigate to url and verify navigated url"), split into atomic steps with navigate FIRST, then the checking action SECOND, using whichever action word the step itself uses for the second part. Do not split a step that only checks the URL with no navigate instruction present — that stays a single step per the Navigate action rules above.
83
- 5.Keywords in the multiple steps should be extracted based on single step and it should not contain any keywords from other steps.
84
- 6. If the step performs the SAME action on TWO OR MORE DIFFERENT target elements joined by "and"/"," (with or without a value), split into separate steps — one per target element — each step keeping the same action (and same value, if any) with its own elementName and keywords. The "step" field for EACH split step must repeat the full action phrase from the original step, not just the element name — this is the one case where "step" is reconstructed rather than a literal substring, since the original sentence never repeated the action for each element.
85
- Example (with value): "enter x in both a and b" -> 1. Enter x in a (elementName "a", keywords ["a"], step: "enter x in a"), 2. Enter x in b (elementName "b", keywords ["b"], step: "enter x in b").
86
- Example (no value): "get text from a and b" -> 1. Get text from a (elementName "a", keywords ["a"], step: "get text from a"), 2. Get text from b (elementName "b", keywords ["b"], step: "get text from b").
87
-
88
- - fileType: If the verify action step mentions verifying or checking any file extension or document (e.g. "pdf" or any file extension), extract that file extension in lowercase (without dot, e.g. "pdf") and set it in fileType. For all non-file/UI verification steps, set fileType to null.
89
-
90
- Respond ONLY with valid JSON in this EXACT format:
91
-
92
- {
93
- "steps": [
94
- {
95
- "keywords": ["key1", "key2"],
96
- "elementName": "element name",
97
- "action": ${allowedActions.join("|")},
98
- "isStepValueDependable": boolean,
99
- "liveLog": "Should Generate a short, human-readable description of what the AI is about to do.",
100
- "fileType": "pdf" | other lowercase file extension | null,
101
- "step": Return the original step exactly as-is if it contains a single action; if multiple actions exist, split into atomic steps without changing any wording, spelling, casing, spacing, or punctuation.(Rules: No rephrasing, no additions/removals—each output step must be an exact substring of the input.)
102
- }
103
- ]
104
- }
105
-
106
-
107
- STEP RULES (VERY IMPORTANT):
108
-
109
- - Each "step" MUST represent EXACTLY ONE action.
110
- ** isStepValueDependable (boolean):
111
- • Set true when action is 'verify' or 'enter' and the step contains a value, comparison value, or referenced subject that represents data from another step, calculated result, or a referenced element/variable. Any explicit or implicit reference to existing, extracted, fetched, retrieved, copied, entered, calculated, or relationally referenced data must be treated as dependable (e.g., "enter calculated final result", "verify calculated value", "enter atpValue in field"). Resolve the reference using priorAndNextSteps when applicable; never consider future steps.
112
- • Set true when action is 'arithmetic' and the step depends on values or variables from earlier steps (e.g., "Multiply atpValue by 3", "Subtract atpdivValue from atpValue", "Store captured value in variable atpValue").
113
- • Set false only when the action has no reference to existing or earlier step data.
114
- • Example: "verify extracted x text is x" → true when "extracted x text" refers to previously obtained data.
115
- • Example: "enter that value in x" → true when "that value" refers to previously obtained data.
116
- • Example: "Multiply atpValue by 3" → true when "atpValue" refers to a value captured in an earlier step.
117
-
118
- - Step MUST be rewritten as a CLEAN and COMPLETE instruction.
119
- - Step MUST contain:
120
- • action
121
- • target element
122
- • value (if applicable)
123
- - DO NOT copy original sentence if it contains multiple actions.
124
- - EXCEPTION: for steps split under Critical Rule 6 (same action repeated across multiple elements), the "step" field is reconstructed to repeat the action phrase per element (see Rule 6) — it will not be a literal substring of the original in this one case.
125
- - DO NOT keep unnecessary words like:
126
- "select", "choose", "pick", "credentials", "details", etc.
127
-
128
- - ALWAYS normalize action wording:
129
-
130
- Examples:
131
- "Select X from Y"
132
- "Click on Y"
133
- "Click on X"
134
-
135
- - Each step must be SELF-CONTAINED and EXECUTABLE.
136
-
137
-
138
- No other text.
6
+ const prompt = `
7
+ You are an expert in Web application testing.
8
+ From the step, extract ONLY the meaningful keywords so that i can search for the element in the dom.
9
+ Rules:
10
+ - Only give response for the current step.
11
+ - understand the step and context from the ${JSON.stringify(priorAndNextSteps)}.and keywords should be from step. it should not be related to other steps.
12
+ - Keywords must represent ONLY the element label or visible text, never add action or instruction words in keywords.
13
+ - Element name + type keywords: strip action words, leaving the core element name and any
14
+ type word(s) attached to it (icon, button, dropdown, filter, tab, field, etc., in the order
15
+ they appear in the step). Build keywords as a growing chain starting from the core name and
16
+ adding one more type word each time: [name], [name+type1], [name+type1+type2], ...
17
+ The core name alone is ALWAYS keyword 1 — never drop it, no matter how many type words follow.
18
+ Treat "input field", "text field", "search box", "check box", "dropdown" as ONE type word,
19
+ not two.
20
+ No type word in the step → only [name] as the keyword.
21
+ Example: "click X filter dropdown" → ["X", "X filter", "X filter dropdown"]
22
+ If more than 3 type words are attached to the element (chain would exceed 5 keywords), keep the core name plus only the 2-3 type words CLOSEST to the element name and drop the rest, so total keywords stay within the 3-5 max.
23
+ - When a step contains two elements connected by a positional or relational phrase, keywords MUST contain at least one keyword from each element — TARGET element first, then the reference element. Never omit the reference element. This includes positional connectors (above, below, next to, under, near) AND possessive/associative connectors (of, for) that link an attribute/property element to a named reference element. Do NOT merge the two elements into a single combined keyword string.
24
+ Example: "Click on x above y" → x is the target, y is the reference → ["x", "y"].
25
+ Example: "get Price of Learn Selenium" → Price is the target attribute, "Learn Selenium" is the reference element → keywords ["Price", "Learn Selenium"], elementName "Price".
26
+ Example: "verify Rating for Learn Selenium is 300" → ["Rating", "Learn Selenium"], elementName "Rating".
27
+ - 3 to 5 keywords maximum. dont give more then 5 keywords. and no need for case sensitive.
28
+ - General ordering rule: whenever a step involves both a target element and a reference/context element, the TARGET element's keyword(s) must always come FIRST, followed by the reference/context element's keyword(s). This applies to positional/relational steps, selection steps, and any other multi-element step.
29
+ - For the open action if they are not provided anything like profile, capablities in the step in that case don't add them check whether the profile and the capablities are present in the step if not please don't add them.
30
+ - For the Open action, if a browser path and profile are provided, return keywords as ["path:<path_value>", "profile:<profile_value>"]. Should not remove backslash from path.
31
+ example: step open browser,x:\\x\\x\\x,default -> ["path:c:\\x\\x\\x","profile:default"]
32
+ - For the Open action, if the user requests specific browser capabilities/arguments, extract them into the keywords array using the "caps:" prefix followed by one of these exact allowed values:
33
+ - "headless" (for running in headless / no-gui mode)
34
+ - "incognito" (for private / incognito mode)
35
+ - "ignoreCertificates" (for ignoring SSL/certificate errors)
36
+ - "startMaximized" (for starting maximized)
37
+ - "disableGpu" (for disabling hardware/GPU acceleration)
38
+ - "disableNotifications" (for blocking push notifications)
39
+ - "disableExtensions" (for disabling browser extensions)
40
+ - "disablePopups" (for disabling popup blocking)
41
+ - "muteAudio" (for muting browser audio)
42
+ - "noSandbox" (for disabling sandbox)
43
+ - "disableWebSecurity" (for disabling web security, CORS, or same-origin policy checks)
44
+ - "disableLocalNetwork" (for disabling WebRTC local IP discovery or local network access constraints)
45
+ - "geolocation" (for blocking or allowing geolocation access)
46
+ - "camera" (for blocking or allowing camera access)
47
+ - "microphone" (for blocking or allowing microphone access)
48
+ - "passwordManager" (for disabling credentials and password manager prompts)
49
+ Do NOT extract or generate any capability strings outside of this list.
50
+ - Do NOT split the keyword into individual words or generate variations such as ["sign", "in"] or ["add", "to", "cart"] for ["Sign In","Add to Cart"]. Only include the original phrase should not add type for first keyword.
51
+ - If the step is about selecting/choosing/picking a SINGLE element with no separate reference element present (e.g. "select the Agree checkbox", "select India"), treat it as ONE step: keywords = [target element] only, action = "click".
52
+ - If the step is about entering text or Uploading file, Should NOT include input value from the step into keywords.
53
+ - If the step has words like tag name audio, video, image,svg, checkbox etc, include them in the keywords.
54
+ - **If icon is mentioned in step then 'svg' should add in keywords ex: click on x icon -> [x, x icon,svg] and for Upload action first keyword should be 'file'. ex: upload file in x -> [file,x].**
55
+ - Do NOT split single-word keywords and do NOT include relation terms (above, below, next to, of, for, etc.) in keywords.
56
+ - Treat each keyword independently never merge different keywords.
57
+ - Keywords can be string or number if the step contains a number as part of the ELEMENT's name/label (e.g. "click on Step 2 tab" -> "Step 2" is a keyword). This does NOT apply to numbers that are the value being entered/typed/uploaded — those stay excluded per the "entering text or Uploading file" rule below, even if numeric (e.g. "Enter 5 in Quantity field" -> "5" is NOT a keyword).
58
+ - Do Not include any other unrelated keywords for step.
59
+ - Do NOT include generic UI words (button, field, etc) and action words (tap, click, press, etc).
60
+ - Do NOT include status/technical words (displayed, enabled, authenticate, visible).
61
+ - If the step is for the switching to android then provide the action as the switchToAndroid
62
+ - element_name: extract name of the element that mentioned in the the step.(eg:tap on x -> element_name:x) keep element_name as short as possible and make the first letter of first word of the element_name as capital. because element_name is also used to find element in the dom. and if element_name is not mentioned in step then return action of the step as element_name.
63
+ - Set action to notwebopenaction only when the instruction is related to a mobile application, app, application, installed package, or bundle .
64
+ - action: click for taping, clicking or selecting, enter for entering input, wait for waiting or sleeping,scroll for scrolling and swiping, navigate for navigating to page using url, navigateBack for navigateing back to previous page, get for getting,fetching,capturing,reading element or text,maximize for maximizing browser window, close for closing browser window,open for opening browser window, upload for uploading file using path, drag_and_drop for dragging and dropping element, switch is for switching to tab or window or frame,cleartext for clearing or removing text from element, mouseAction for the action related mouse actions even for mouse click , refresh is for refreshing or reloading pages, getOtp for fetching/reading an OTP value, arithmetic for performing arithmetic operations (multiply, divide, add, subtract, calculate).
65
+ - If mouse action related step is there select mouseAction from the allowed actions list check for the step and provide it.
66
+ - action must be one of from this list ${JSON.stringify(allowedActions)}.if not one of them, return '0'. if step about set or find action return '0'
67
+ - For navigate action, keywords should contain only one keyword which is full url from the step and should not include any other text. and if step has another actions, including navigate action, don't return navigate action return another action which is in the step. and element_name should be "URL".
68
+ - Navigate action rules:
69
+ - Use action "navigate" ONLY when the step gives an explicit instruction to go to a URL (e.g., "Navigate to https://x.com"). keywords must contain only the full URL, nothing else. elementName should be "URL".
70
+ - If the step ONLY checks/confirms the current or already-navigated URL, with NO "go to/navigate to" instruction present in that same step (e.g., "Verify navigated URL", "Get navigated URL"), return whichever action word the step itself uses (verify, get, check, confirm, etc. — never "navigate"), and do NOT split it — it is already a single atomic step. keywords should be ["URL"], elementName "URL".
71
+ CRITICAL RULES:
72
+ 1.If the step contains multiple actions, you MUST split it into multiple objects in the "steps" array in the same sequence and generate the response object in the same flow.
73
+ - Each object must represent EXACTLY ONE action.
74
+ - Preserve the ORIGINAL ORDER of actions strictly.
75
+ Example 1: "Enter username , Password as Username and Password and click on button", should be split into 3 steps: 1.Enter Username in Username, 2.Enter Password in Password, 3.Click on button. and elementName for first step should be Username, for second step should be Password and for third step should be click on button.
76
+
77
+ 2.If the step contains Select, choose, pick and also contains a connecting word to a reference element ("from", "in", "on", "under") then you must always split into exactly two steps, click on the reference element first and then click on the target value. elementName for the first step should be the reference element (mentioned after the connecting word), and for the second step it should be the target value (mentioned after select/choose/pick). if the step has more than one connecting word then consider only the first one for elementName and keyword extraction.
78
+ Example: "Select 'India' from Country" → 1.Click on Country, 2.Click on India. elementName for first step should be Country and for second step should be India.
79
+ Example: "select 'x' in 'y'" → 1.Click on y, 2.Click on x. elementName for first step should be y and for second step should be x.
80
+ 3.If the step contains a compound action (e.g., "Enter text in field and click button"), you MUST split it into separate steps for each action, ensuring that each step is represented as a distinct object in the "steps" array with its own keywords and elementName.
81
+ Example: "Enter 'John' in Name field and click Submit" → 1.Enter 'John' in Name field, 2.Click on Submit. and elementName for first step should be Name field and for second step should be Submit.
82
+ 4. ONLY IF the step text itself contains BOTH an explicit "go to/navigate to URL" instruction AND a separate URL-checking instruction (e.g., "Navigate to url and verify navigated url"), split into atomic steps with navigate FIRST, then the checking action SECOND, using whichever action word the step itself uses for the second part. Do not split a step that only checks the URL with no navigate instruction present — that stays a single step per the Navigate action rules above.
83
+ 5.Keywords in the multiple steps should be extracted based on single step and it should not contain any keywords from other steps.
84
+ 6. If the step performs the SAME action on TWO OR MORE DIFFERENT target elements joined by "and"/"," (with or without a value), split into separate steps — one per target element — each step keeping the same action (and same value, if any) with its own elementName and keywords. The "step" field for EACH split step must repeat the full action phrase from the original step, not just the element name — this is the one case where "step" is reconstructed rather than a literal substring, since the original sentence never repeated the action for each element.
85
+ Example (with value): "enter x in both a and b" -> 1. Enter x in a (elementName "a", keywords ["a"], step: "enter x in a"), 2. Enter x in b (elementName "b", keywords ["b"], step: "enter x in b").
86
+ Example (no value): "get text from a and b" -> 1. Get text from a (elementName "a", keywords ["a"], step: "get text from a"), 2. Get text from b (elementName "b", keywords ["b"], step: "get text from b").
87
+
88
+ - fileType: If the verify action step mentions verifying or checking any file extension or document (e.g. "pdf" or any file extension), extract that file extension in lowercase (without dot, e.g. "pdf") and set it in fileType. For all non-file/UI verification steps, set fileType to null.
89
+
90
+ Respond ONLY with valid JSON in this EXACT format:
91
+
92
+ {
93
+ "steps": [
94
+ {
95
+ "keywords": ["key1", "key2"],
96
+ "elementName": "element name",
97
+ "action": ${allowedActions.join("|")},
98
+ "isStepValueDependable": boolean,
99
+ "liveLog": "Should Generate a short, human-readable description of what the AI is about to do.",
100
+ "fileType": "pdf" | other lowercase file extension | null,
101
+ "step": Return the original step exactly as-is if it contains a single action; if multiple actions exist, split into atomic steps without changing any wording, spelling, casing, spacing, or punctuation.(Rules: No rephrasing, no additions/removals—each output step must be an exact substring of the input.)
102
+ }
103
+ ]
104
+ }
105
+
106
+
107
+ STEP RULES (VERY IMPORTANT):
108
+
109
+ - Each "step" MUST represent EXACTLY ONE action.
110
+ ** isStepValueDependable (boolean):
111
+ • Set true when action is 'verify' or 'enter' and the step contains a value, comparison value, or referenced subject that represents data from another step, calculated result, or a referenced element/variable. Any explicit or implicit reference to existing, extracted, fetched, retrieved, copied, entered, calculated, or relationally referenced data must be treated as dependable (e.g., "enter calculated final result", "verify calculated value", "enter atpValue in field"). Resolve the reference using priorAndNextSteps when applicable; never consider future steps.
112
+ • Set true when action is 'arithmetic' and the step depends on values or variables from earlier steps (e.g., "Multiply atpValue by 3", "Subtract atpdivValue from atpValue", "Store captured value in variable atpValue").
113
+ • Set false only when the action has no reference to existing or earlier step data.
114
+ • Example: "verify extracted x text is x" → true when "extracted x text" refers to previously obtained data.
115
+ • Example: "enter that value in x" → true when "that value" refers to previously obtained data.
116
+ • Example: "Multiply atpValue by 3" → true when "atpValue" refers to a value captured in an earlier step.
117
+
118
+ - Step MUST be rewritten as a CLEAN and COMPLETE instruction.
119
+ - Step MUST contain:
120
+ • action
121
+ • target element
122
+ • value (if applicable)
123
+ - DO NOT copy original sentence if it contains multiple actions.
124
+ - EXCEPTION: for steps split under Critical Rule 6 (same action repeated across multiple elements), the "step" field is reconstructed to repeat the action phrase per element (see Rule 6) — it will not be a literal substring of the original in this one case.
125
+ - DO NOT keep unnecessary words like:
126
+ "select", "choose", "pick", "credentials", "details", etc.
127
+
128
+ - ALWAYS normalize action wording:
129
+
130
+ Examples:
131
+ "Select X from Y"
132
+ "Click on Y"
133
+ "Click on X"
134
+
135
+ - Each step must be SELF-CONTAINED and EXECUTABLE.
136
+
137
+
138
+ No other text.
139
139
  `;
140
140
  return prompt;
141
141
  }
@@ -3,46 +3,46 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.arithmeticPrompt = arithmeticPrompt;
4
4
  async function arithmeticPrompt({ inputStepsContext, }) {
5
5
  const arithmetic = ["multiply", "divide", "add", "subtract"];
6
- const prompt = `
7
- You are an intelligent assistant that extracts arithmetic operations and operands from test steps.
8
-
9
- Previous steps data:
10
- ${JSON.stringify(inputStepsContext, null, 2)}
11
-
12
- Instructions:
13
- 1. Analyze the current step and use Previous steps data to resolve any operand that refers to data from an earlier step.
14
- 2. Extract exactly two operands, their corresponding variable names when available, the arithmetic operation, and the target variable name.
15
-
16
- Rules for "operation":
17
- - Return ONLY one of: "multiply", "divide", "add", "subtract".
18
- - Determine the operation directly from the current step.
19
-
20
- Rules for "operandOne" and "operandTwo":
21
- - If an operand is a literal number, return only the numeric value as a string.Remove currency symbols, special characters, commas, or other non - numeric symbols.Example: "$2" -> "2".
22
- - If an operand refers to an earlier step or its value using contextual or relational wording, find the matching step in Previous steps data and use that step's inputText/value as the operand and its variableName as the corresponding operandVariableName.
23
- - If the referenced earlier step contains both inputText and variableName, always use the inputText for the operand and the exact variableName for its operandVariableName.
24
- - If an operand is a variable already present in Previous steps data, use its exact variableName.
25
- - If no variableName exists for a literal operand, set its operandVariableName to null.
26
- - Do not include symbols, descriptions, element names, or explanations in operandOne or operandTwo.
27
-
28
- Rules for "subtract":
29
- - "Subtract X from Y" -> operandOne = Y, operandTwo = X.
30
- - For other subtraction wording, follow the operand order expressed by the step.
31
-
32
- Rules for "variableName":
33
- - If the current step explicitly provides a target variable name, use that exact name without modifying it.
34
- - Otherwise, generate a valid descriptive variable name based on the operation and result.
35
- - The generated name must contain only letters, digits, or underscores and must not start with a digit.
36
-
37
- Respond ONLY with valid JSON in this exact format:
38
- {
39
- "operandOne": "x",
40
- "operandTwo": "y",
41
- "operandOneVariableName": "variableName1 | null",
42
- "operandTwoVariableName": "variableName2 | null",
43
- "operation": ${arithmetic.join("|")},
44
- "variableName": "targetVariableName"
45
- }
6
+ const prompt = `
7
+ You are an intelligent assistant that extracts arithmetic operations and operands from test steps.
8
+
9
+ Previous steps data:
10
+ ${JSON.stringify(inputStepsContext, null, 2)}
11
+
12
+ Instructions:
13
+ 1. Analyze the current step and use Previous steps data to resolve any operand that refers to data from an earlier step.
14
+ 2. Extract exactly two operands, their corresponding variable names when available, the arithmetic operation, and the target variable name.
15
+
16
+ Rules for "operation":
17
+ - Return ONLY one of: "multiply", "divide", "add", "subtract".
18
+ - Determine the operation directly from the current step.
19
+
20
+ Rules for "operandOne" and "operandTwo":
21
+ - If an operand is a literal number, return only the numeric value as a string.Remove currency symbols, special characters, commas, or other non - numeric symbols.Example: "$2" -> "2".
22
+ - If an operand refers to an earlier step or its value using contextual or relational wording, find the matching step in Previous steps data and use that step's inputText/value as the operand and its variableName as the corresponding operandVariableName.
23
+ - If the referenced earlier step contains both inputText and variableName, always use the inputText for the operand and the exact variableName for its operandVariableName.
24
+ - If an operand is a variable already present in Previous steps data, use its exact variableName.
25
+ - If no variableName exists for a literal operand, set its operandVariableName to null.
26
+ - Do not include symbols, descriptions, element names, or explanations in operandOne or operandTwo.
27
+
28
+ Rules for "subtract":
29
+ - "Subtract X from Y" -> operandOne = Y, operandTwo = X.
30
+ - For other subtraction wording, follow the operand order expressed by the step.
31
+
32
+ Rules for "variableName":
33
+ - If the current step explicitly provides a target variable name, use that exact name without modifying it.
34
+ - Otherwise, generate a valid descriptive variable name based on the operation and result.
35
+ - The generated name must contain only letters, digits, or underscores and must not start with a digit.
36
+
37
+ Respond ONLY with valid JSON in this exact format:
38
+ {
39
+ "operandOne": "x",
40
+ "operandTwo": "y",
41
+ "operandOneVariableName": "variableName1 | null",
42
+ "operandTwoVariableName": "variableName2 | null",
43
+ "operation": ${arithmetic.join("|")},
44
+ "variableName": "targetVariableName"
45
+ }
46
46
  `;
47
47
  return prompt;
48
48
  }
@@ -4,42 +4,42 @@ exports.fileVerifyActionExtractorPrompt = fileVerifyActionExtractorPrompt;
4
4
  async function fileVerifyActionExtractorPrompt({ extractedDomJson, priorAndNextSteps, }) {
5
5
  const nlpList = `VerifyPDF,CompareTwoPdf,VerifyPDFExist,CheckAccessibilityForPdfUsingPython,CheckIfPdfIsXfaFrom,VerifyElementIsDisplayed,VerifyElementIsNotDisplayed,VerifyElementIsEnabled,VerifyElementIsDisabled,VerifyElementIsClickable,VerifyNavigateURL,VerifyIfLinkIsWorking`;
6
6
  const elementType = ['link', 'textfield', 'icon', 'button', 'radioButton', 'text', 'textarea', 'image', 'dropdown', 'checkbox', 'tab', 'action overflow button', 'hamburger icon', 'toggle button', 'suggestion', 'time picker', 'date picker', 'toaster message', 'card', 'tooltip', 'option', 'calender', 'sliders', 'visual testing'];
7
- const prompt = `You are an intelligent assistant that extracts structured UI action data for file and element verification.
8
- Given the step, the simplified DOM: ${extractedDomJson}, and the list of NLP names: ${nlpList} don't provide the other nlp names which are not present in the list in any manner.
9
-
10
- Select the perfect matching NLP name from the list that best fits the step's intent.
11
- **The NLP name must match exactly one value from the approved NLP list. Do not generate or suggest any new NLP names under any condition.**
12
- step may give any way, you need to get most matching and most related nlp name from the list that relates to step.
13
-
14
- - Return ONLY a valid JSON object; the response must start with '{' and end with '}', with no markdown, code fences, explanations, or extra text.
15
- Return **only valid JSON** in the following format:
16
- {
17
- "attributeValue": "Fire-Flink-x",
18
- "nlpName": "x",
19
- "inputText": "x",
20
- "elementType": "x",
21
- "isDownload": true,
22
- "path": null
23
- }
24
-
25
- Rules:
26
- - PDF steps: if step specifies checking/verifying text, content, or phrases inside a PDF → choose VerifyPDF and extract the expected text into inputText | if step only verifies the presence, creation, or download of the file without checking inner text → choose VerifyPDFExist with inputText: "".
27
- - nlpName must be exactly one from the provided list.
28
- - While matching nlpName with step (ignore spaces, case differences). If multiple NLPs are similar, choose the MOST SPECIFIC and EXACT match.
29
- - Use context from the steps: ${priorAndNextSteps}, keyword and json to search for FF-inspecter.
30
- - **Find the FF-inspecter attribute value of the element in the Simplified JSON whose text or any other attributes best match the step in the simplified DOM.**
31
- - If no matching element found for the step or if step is file/pdf verification, return attributeValue as 'Fire-Flink-0'.
32
- - **inputText rules**: Extract ONLY the expected text phrase to verify inside the PDF or element. Strip any wrapping quotes (' or "). **NEVER include the file path or file name in inputText**. If no text is being verified, return "".
33
- - Based on step give most relevant type of element. Use this list to choose elementType: ${elementType}. If elementType is not there in list return 'link'.
34
- - **isDownload & path rules**:
35
- - If the step contains both a file path and expected text (e.g. "Verify existing PDF contains text 'path/to/doc.pdf',Expected Text" or "Verify PDF 'path/to/doc.pdf' contains 'Expected Text'"):
36
- • Extract the file path into "path" (stripped of surrounding quotes).
37
- • Extract ONLY the search phrase into "inputText" (do NOT include the file path in inputText).
38
- • Set isDownload: false.
39
- - If verifying an existing file at a specified path or location (e.g. contains drive letter C:, /, or file extension .pdf) → set isDownload: false and path to the extracted file path string.
40
- - If the step is about verifying a file downloaded via the browser (e.g. "verify downloaded pdf", "verify pdf", or no explicit file path is given) → set isDownload: true and path: null.
41
- - **path formatting**: Extract the file path from the step and add extra //// for path like "C:////Users/////User/////Downloads/////file.pdf" (strip surrounding quotes).
42
- - **Respond with valid JSON only. don't return any other text or don't return response in list format**
7
+ const prompt = `You are an intelligent assistant that extracts structured UI action data for file and element verification.
8
+ Given the step, the simplified DOM: ${extractedDomJson}, and the list of NLP names: ${nlpList} don't provide the other nlp names which are not present in the list in any manner.
9
+
10
+ Select the perfect matching NLP name from the list that best fits the step's intent.
11
+ **The NLP name must match exactly one value from the approved NLP list. Do not generate or suggest any new NLP names under any condition.**
12
+ step may give any way, you need to get most matching and most related nlp name from the list that relates to step.
13
+
14
+ - Return ONLY a valid JSON object; the response must start with '{' and end with '}', with no markdown, code fences, explanations, or extra text.
15
+ Return **only valid JSON** in the following format:
16
+ {
17
+ "attributeValue": "Fire-Flink-x",
18
+ "nlpName": "x",
19
+ "inputText": "x",
20
+ "elementType": "x",
21
+ "isDownload": true,
22
+ "path": null
23
+ }
24
+
25
+ Rules:
26
+ - PDF steps: if step specifies checking/verifying text, content, or phrases inside a PDF → choose VerifyPDF and extract the expected text into inputText | if step only verifies the presence, creation, or download of the file without checking inner text → choose VerifyPDFExist with inputText: "".
27
+ - nlpName must be exactly one from the provided list.
28
+ - While matching nlpName with step (ignore spaces, case differences). If multiple NLPs are similar, choose the MOST SPECIFIC and EXACT match.
29
+ - Use context from the steps: ${priorAndNextSteps}, keyword and json to search for FF-inspecter.
30
+ - **Find the FF-inspecter attribute value of the element in the Simplified JSON whose text or any other attributes best match the step in the simplified DOM.**
31
+ - If no matching element found for the step or if step is file/pdf verification, return attributeValue as 'Fire-Flink-0'.
32
+ - **inputText rules**: Extract ONLY the expected text phrase to verify inside the PDF or element. Strip any wrapping quotes (' or "). **NEVER include the file path or file name in inputText**. If no text is being verified, return "".
33
+ - Based on step give most relevant type of element. Use this list to choose elementType: ${elementType}. If elementType is not there in list return 'link'.
34
+ - **isDownload & path rules**:
35
+ - If the step contains both a file path and expected text (e.g. "Verify existing PDF contains text 'path/to/doc.pdf',Expected Text" or "Verify PDF 'path/to/doc.pdf' contains 'Expected Text'"):
36
+ • Extract the file path into "path" (stripped of surrounding quotes).
37
+ • Extract ONLY the search phrase into "inputText" (do NOT include the file path in inputText).
38
+ • Set isDownload: false.
39
+ - If verifying an existing file at a specified path or location (e.g. contains drive letter C:, /, or file extension .pdf) → set isDownload: false and path to the extracted file path string.
40
+ - If the step is about verifying a file downloaded via the browser (e.g. "verify downloaded pdf", "verify pdf", or no explicit file path is given) → set isDownload: true and path: null.
41
+ - **path formatting**: Extract the file path from the step and add extra //// for path like "C:////Users/////User/////Downloads/////file.pdf" (strip surrounding quotes).
42
+ - **Respond with valid JSON only. don't return any other text or don't return response in list format**
43
43
  `;
44
44
  return prompt;
45
45
  }
@@ -88,7 +88,7 @@ Rules:
88
88
  else if (stepAction === "swipe" || stepAction === "scroll") {
89
89
  prompt = `
90
90
  You are an intelligent assistant that extracts structured mobile scroll/swipe action data.
91
- Given the step: ${JSON.stringify(priorAndNextSteps)}, the simplified DOM (for scroll context): ${extractedDomJson}, and the list of NLP names: ${SwipeActions}.
91
+ Given the step: ${JSON.stringify(priorAndNextSteps)}, the simplified DOM (for scroll context): ${extractedDomJson}, and the list of NLP names: ${SwipeActions.join("|")}.
92
92
 
93
93
  Select the perfect matching NLP name from the list that best fits the step's intent.
94
94
 
@@ -98,7 +98,7 @@ Return **only valid JSON** in the following format:
98
98
  "nlpName": "x",
99
99
  "inputText": "x",
100
100
  "keyword": "x",
101
- "type": "x",
101
+ "elementType": "x",
102
102
  "numOfScrolls": "x",
103
103
  "direction": "x"
104
104
  }}
@@ -120,10 +120,10 @@ example: swipe up to "Contact Us" using "Settings" as reference.
120
120
  - **Extraction**:
121
121
  - inputText: The target element in the step.e.g., "swipe to submit text",then input text must be "submit",Dont include its type in inputText like text,button,icon etc...Leave empty if just swiping N times, if coordinates are specified then give coordinates in inputText like (x1,y1,x2,y2) where x1,y1 is starting coordinate and x2,y2 is ending coordinate.**
122
122
  - keyword: Crucial keyword from step (e.g., "Settings").
123
- - nomOfScrolls: Extract count if specified (e.g., "scroll 3 times"). Default to 0 if not specified but action implies generic scroll.
123
+ - nomOfScrolls: Extract if specified (e.g., "scroll 3 times"). Default to 0 if not specified but action implies generic scroll.
124
124
  - direction: "up", "down", "left", "right". Infer from step (e.g., "Scroll down" -> "down"). If direction is not specified, default direction to "none".
125
125
  - attributeValue: If an element is visible and matches the target, provide its FF-inspecter. Otherwise "Fire-Flink-2".
126
- - type: Based on step give most relevant type of element. use this list to choose elementType: ${elementType} and Never change syntax of elementType, follow the syntax of elementType in list.if elementType is not there in list return 'link'.
126
+ - elementType: Based on step give most relevant type of element. use this list to choose elementType: ${elementType.join("|")} and Never change syntax of elementType, follow the syntax of elementType in list.if elementType is not there in list return 'link'.
127
127
  - Return ONLY a valid JSON object; the response must start with '{' and end with '}', with no markdown, code fences, explanations, or extra text.
128
128
 
129
129
  - response:valid json only.`;