automation_model 1.0.28 → 1.0.30

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.
@@ -119,7 +119,12 @@ class StableBrowser {
119
119
  let element = await this._locate(selector, info, _params);
120
120
 
121
121
  await this._screenShot(options);
122
- await element.click({ timeout: 10000 });
122
+ try {
123
+ await element.click({ timeout: 5000 });
124
+ } catch (e) {
125
+ info.log.push("click failed, will try force click");
126
+ await element.click({ timeout: 10000, force: true });
127
+ }
123
128
  return info;
124
129
  } catch (e) {
125
130
  this.logger.error("click failed " + JSON.stringify(info));
@@ -130,6 +135,34 @@ class StableBrowser {
130
135
  this.logger.info("click failed, will try next selector");
131
136
  }
132
137
  }
138
+
139
+ async selectOption(selector, values, _params = null, options = {}) {
140
+ const info = {};
141
+ info.log = [];
142
+ info.operation = "selectOptions";
143
+ info.selector = selector;
144
+
145
+ try {
146
+ let element = await this._locate(selector, info, _params);
147
+
148
+ await this._screenShot(options);
149
+ try {
150
+ await element.selectOption(values, { timeout: 5000 });
151
+ } catch (e) {
152
+ info.log.push("selectOption failed, will try force");
153
+ await element.selectOption(values, { timeout: 10000, force: true });
154
+ }
155
+ return info;
156
+ } catch (e) {
157
+ this.logger.error("selectOption failed " + JSON.stringify(info));
158
+ Object.assign(e, { info: info });
159
+ await this._screenShot(options);
160
+ throw e;
161
+
162
+ this.logger.info("click failed, will try next selector");
163
+ }
164
+ }
165
+
133
166
  async fill(selector, value, _params = null, options = {}) {
134
167
  const info = {};
135
168
  info.log = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automation_model",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "An automation infrastructure module to be use for generative AI automation projects.",
5
5
  "main": "bin/index.js",
6
6
  "type": "module",