appium-xcuitest-driver 4.32.2 → 4.32.4
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.
- package/CHANGELOG.md +14 -0
- package/build/lib/css-converter.d.ts +0 -75
- package/build/lib/css-converter.d.ts.map +1 -1
- package/build/lib/css-converter.js +81 -106
- package/build/lib/css-converter.js.map +1 -1
- package/lib/css-converter.js +83 -112
- package/npm-shrinkwrap.json +598 -876
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [4.32.4](https://github.com/appium/appium-xcuitest-driver/compare/v4.32.3...v4.32.4) (2023-06-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update dependency css-selector-parser to v2 ([#1759](https://github.com/appium/appium-xcuitest-driver/issues/1759)) ([0426349](https://github.com/appium/appium-xcuitest-driver/commit/0426349da313127111c19d4de44151ab45ecb64f))
|
|
7
|
+
|
|
8
|
+
## [4.32.3](https://github.com/appium/appium-xcuitest-driver/compare/v4.32.2...v4.32.3) (2023-06-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency appium-webdriveragent to v5.5.1 ([#1770](https://github.com/appium/appium-xcuitest-driver/issues/1770)) ([e1c1bc9](https://github.com/appium/appium-xcuitest-driver/commit/e1c1bc932c9d550d1aaa1e82b6638eea8952c616))
|
|
14
|
+
|
|
1
15
|
## [4.32.2](https://github.com/appium/appium-xcuitest-driver/compare/v4.32.1...v4.32.2) (2023-06-14)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1,79 +1,4 @@
|
|
|
1
1
|
export default CssConverter;
|
|
2
|
-
export type CssNameValueObject = {
|
|
3
|
-
/**
|
|
4
|
-
* The name of the CSS object
|
|
5
|
-
*/
|
|
6
|
-
name?: string | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* The value of the CSS object
|
|
9
|
-
*/
|
|
10
|
-
value?: string | undefined;
|
|
11
|
-
};
|
|
12
|
-
export type CssAttr = {
|
|
13
|
-
name?: string | undefined;
|
|
14
|
-
/**
|
|
15
|
-
* Type of attribute (must be string or empty)
|
|
16
|
-
*/
|
|
17
|
-
valueType?: string | undefined;
|
|
18
|
-
/**
|
|
19
|
-
* Value of the attribute
|
|
20
|
-
*/
|
|
21
|
-
value?: string | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* The operator between value and value type (=, *=, , ^=, $=)
|
|
24
|
-
*/
|
|
25
|
-
operator?: string | undefined;
|
|
26
|
-
};
|
|
27
|
-
export type CssPseudo = {
|
|
28
|
-
/**
|
|
29
|
-
* The type of CSS pseudo selector (https://www.npmjs.com/package/css-selector-parser for reference)
|
|
30
|
-
*/
|
|
31
|
-
valueType?: string | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* The name of the pseudo selector
|
|
34
|
-
*/
|
|
35
|
-
name?: string | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* The value of the pseudo selector
|
|
38
|
-
*/
|
|
39
|
-
value?: string | undefined;
|
|
40
|
-
};
|
|
41
|
-
export type CssRule = {
|
|
42
|
-
/**
|
|
43
|
-
* The nesting operator (aka: combinator https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors)
|
|
44
|
-
*/
|
|
45
|
-
nestingOperator?: string | undefined;
|
|
46
|
-
/**
|
|
47
|
-
* The tag name (aka: type selector https://developer.mozilla.org/en-US/docs/Web/CSS/Type_selectors)
|
|
48
|
-
*/
|
|
49
|
-
tagName?: string | undefined;
|
|
50
|
-
/**
|
|
51
|
-
* An array of CSS class names
|
|
52
|
-
*/
|
|
53
|
-
classNames?: string[] | undefined;
|
|
54
|
-
/**
|
|
55
|
-
* An array of CSS attributes
|
|
56
|
-
*/
|
|
57
|
-
attrs?: CssAttr[] | undefined;
|
|
58
|
-
/**
|
|
59
|
-
* An array of CSS pseudos
|
|
60
|
-
*/
|
|
61
|
-
pseudos?: CssPseudo[] | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* CSS identifier
|
|
64
|
-
*/
|
|
65
|
-
id?: string | undefined;
|
|
66
|
-
/**
|
|
67
|
-
* A descendant of this CSS rule
|
|
68
|
-
*/
|
|
69
|
-
rule?: CssRule | undefined;
|
|
70
|
-
};
|
|
71
|
-
export type CssObject = {
|
|
72
|
-
/**
|
|
73
|
-
* Type of CSS object. 'rule', 'ruleset' or 'selectors'
|
|
74
|
-
*/
|
|
75
|
-
type?: string | undefined;
|
|
76
|
-
};
|
|
77
2
|
declare namespace CssConverter {
|
|
78
3
|
/**
|
|
79
4
|
* Convert a CSS selector to a iOS Class Chain selector
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-converter.d.ts","sourceRoot":"","sources":["../../lib/css-converter.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"css-converter.d.ts","sourceRoot":"","sources":["../../lib/css-converter.js"],"names":[],"mappings":";;IAoQA;;;;OAIG;IACH,8DAcC"}
|
|
@@ -6,12 +6,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const css_selector_parser_1 = require("css-selector-parser");
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
const driver_1 = require("appium/driver");
|
|
9
|
+
const logger_js_1 = __importDefault(require("./logger.js"));
|
|
9
10
|
const CssConverter = {};
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const parseCssSelector = (0, css_selector_parser_1.createParser)({
|
|
12
|
+
syntax: {
|
|
13
|
+
pseudoClasses: {
|
|
14
|
+
unknown: 'accept',
|
|
15
|
+
definitions: {
|
|
16
|
+
Selector: ['has'],
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
combinators: ['>', '+', '~'],
|
|
20
|
+
attributes: {
|
|
21
|
+
operators: ['^=', '$=', '*=', '~=', '=']
|
|
22
|
+
},
|
|
23
|
+
ids: true,
|
|
24
|
+
classNames: true,
|
|
25
|
+
tag: {
|
|
26
|
+
wildcard: true
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
substitutes: true
|
|
30
|
+
});
|
|
15
31
|
const BOOLEAN_ATTRS = [
|
|
16
32
|
'visible', 'accessible', 'accessibility-container', 'enabled',
|
|
17
33
|
];
|
|
@@ -36,7 +52,7 @@ const ATTRIBUTE_ALIASES = [
|
|
|
36
52
|
/**
|
|
37
53
|
* Convert hyphen separated word to camel case
|
|
38
54
|
*
|
|
39
|
-
* @param {string} str
|
|
55
|
+
* @param {string?} str
|
|
40
56
|
* @returns {string} The hyphen separated word translated to camel case
|
|
41
57
|
*/
|
|
42
58
|
function toCamelCase(str) {
|
|
@@ -47,19 +63,16 @@ function toCamelCase(str) {
|
|
|
47
63
|
const out = tokens.join('');
|
|
48
64
|
return out.charAt(0).toLowerCase() + out.slice(1);
|
|
49
65
|
}
|
|
50
|
-
/**
|
|
51
|
-
* @typedef {Object} CssNameValueObject
|
|
52
|
-
* @property {string} [name] The name of the CSS object
|
|
53
|
-
* @property {string} [value] The value of the CSS object
|
|
54
|
-
*/
|
|
55
66
|
/**
|
|
56
67
|
* Get the boolean from a CSS object. If empty, return true. If not true/false/empty, throw exception
|
|
57
68
|
*
|
|
58
|
-
* @param {
|
|
69
|
+
* @param {import('css-selector-parser').AstAttribute|import('css-selector-parser').AstPseudoClass} cssAttr
|
|
59
70
|
* @returns {string} Either 'true' or 'false'. If value is empty, return 'true'
|
|
60
71
|
*/
|
|
61
|
-
function requireBoolean(
|
|
62
|
-
|
|
72
|
+
function requireBoolean(cssAttr) {
|
|
73
|
+
// @ts-ignore We only support strings
|
|
74
|
+
const attrValue = cssAttr.value?.value;
|
|
75
|
+
const val = lodash_1.default.toLower(attrValue) || 'true'; // an omitted boolean attribute means 'true' (e.g.: input[checked] means checked is true)
|
|
63
76
|
switch (val) {
|
|
64
77
|
case '0':
|
|
65
78
|
case 'false':
|
|
@@ -68,7 +81,7 @@ function requireBoolean(css) {
|
|
|
68
81
|
case 'true':
|
|
69
82
|
return '1';
|
|
70
83
|
default:
|
|
71
|
-
throw new TypeError(`'${
|
|
84
|
+
throw new TypeError(`'${cssAttr.name}' must be true/1 or false/0 or empty. Found '${attrValue}'`);
|
|
72
85
|
}
|
|
73
86
|
}
|
|
74
87
|
/**
|
|
@@ -77,43 +90,38 @@ function requireBoolean(css) {
|
|
|
77
90
|
* Converts to lowercase and if an attribute name is an alias for something else, return
|
|
78
91
|
* what it is an alias for
|
|
79
92
|
*
|
|
80
|
-
* @param {
|
|
93
|
+
* @param {import('css-selector-parser').AstAttribute|import('css-selector-parser').AstPseudoClass} cssEntity
|
|
81
94
|
* @returns {string} The canonical attribute name
|
|
82
95
|
*/
|
|
83
|
-
function
|
|
84
|
-
const
|
|
96
|
+
function requireEntityName(cssEntity) {
|
|
97
|
+
const entityName = cssEntity.name.toLowerCase();
|
|
85
98
|
// Check if it's supported and if it is, return it
|
|
86
|
-
if (ALL_ATTRS.includes(
|
|
87
|
-
return
|
|
99
|
+
if (ALL_ATTRS.includes(entityName)) {
|
|
100
|
+
return entityName.toLowerCase();
|
|
88
101
|
}
|
|
89
102
|
// If attrName is an alias for something else, return that
|
|
90
103
|
for (const [officialAttr, aliasAttrs] of ATTRIBUTE_ALIASES) {
|
|
91
|
-
if (aliasAttrs.includes(
|
|
104
|
+
if (aliasAttrs.includes(entityName)) {
|
|
92
105
|
return officialAttr;
|
|
93
106
|
}
|
|
94
107
|
}
|
|
95
|
-
throw new Error(`'${
|
|
96
|
-
`Supported attributes are '${ALL_ATTRS.join(', ')}'`);
|
|
108
|
+
throw new Error(`'${entityName}' is not a valid attribute. ` +
|
|
109
|
+
`Supported attributes are: '${ALL_ATTRS.join(', ')}'`);
|
|
97
110
|
}
|
|
98
|
-
/**
|
|
99
|
-
* @typedef {Object} CssAttr
|
|
100
|
-
* @property {string} [name]
|
|
101
|
-
* @property {string} [valueType] Type of attribute (must be string or empty)
|
|
102
|
-
* @property {string} [value] Value of the attribute
|
|
103
|
-
* @property {string} [operator] The operator between value and value type (=, *=, , ^=, $=)
|
|
104
|
-
*/
|
|
105
111
|
/**
|
|
106
112
|
* Convert a CSS attribute into a UiSelector method call
|
|
107
113
|
*
|
|
108
|
-
* @param {
|
|
114
|
+
* @param {import('css-selector-parser').AstAttribute} cssAttr CSS attribute object
|
|
109
115
|
* @returns {string|{index: string|undefined}} CSS attribute parsed as UiSelector
|
|
110
116
|
*/
|
|
111
117
|
function parseAttr(cssAttr) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
// @ts-ignore We only care for strings
|
|
119
|
+
const attrValue = cssAttr.value?.value;
|
|
120
|
+
if (!lodash_1.default.isString(attrValue) && !lodash_1.default.isEmpty(attrValue)) {
|
|
121
|
+
throw new TypeError(`'${cssAttr.name}=${attrValue}' is an invalid attribute. ` +
|
|
122
|
+
`Only 'string' and empty attribute types are supported. Found '${attrValue}'`);
|
|
115
123
|
}
|
|
116
|
-
const attrName = toCamelCase(
|
|
124
|
+
const attrName = toCamelCase(requireEntityName(cssAttr));
|
|
117
125
|
// Validate that it's a supported attribute
|
|
118
126
|
if (!STR_ATTRS.includes(attrName) && !BOOLEAN_ATTRS.includes(attrName)) {
|
|
119
127
|
throw new Error(`'${attrName}' is not supported. Supported attributes are ` +
|
|
@@ -121,12 +129,12 @@ function parseAttr(cssAttr) {
|
|
|
121
129
|
}
|
|
122
130
|
// Parse index if it's an index attribute
|
|
123
131
|
if (attrName === 'index') {
|
|
124
|
-
return { index:
|
|
132
|
+
return { index: attrValue };
|
|
125
133
|
}
|
|
126
134
|
if (BOOLEAN_ATTRS.includes(attrName)) {
|
|
127
135
|
return `${attrName} == ${requireBoolean(cssAttr)}`;
|
|
128
136
|
}
|
|
129
|
-
let value =
|
|
137
|
+
let value = attrValue || '';
|
|
130
138
|
if (value === '') {
|
|
131
139
|
return `[${attrName} LIKE ${value}]`;
|
|
132
140
|
}
|
|
@@ -147,49 +155,34 @@ function parseAttr(cssAttr) {
|
|
|
147
155
|
` '=', '*=', '^=', '$=' and '~=' are supported.`);
|
|
148
156
|
}
|
|
149
157
|
}
|
|
150
|
-
/**
|
|
151
|
-
* @typedef {Object} CssPseudo
|
|
152
|
-
* @property {string} [valueType] The type of CSS pseudo selector (https://www.npmjs.com/package/css-selector-parser for reference)
|
|
153
|
-
* @property {string} [name] The name of the pseudo selector
|
|
154
|
-
* @property {string} [value] The value of the pseudo selector
|
|
155
|
-
*/
|
|
156
158
|
/**
|
|
157
159
|
* Convert a CSS pseudo class to a UiSelector
|
|
158
160
|
*
|
|
159
|
-
* @param {
|
|
161
|
+
* @param {import('css-selector-parser').AstPseudoClass} cssPseudo
|
|
160
162
|
* @returns {string|{index: string|undefined}|undefined} Pseudo selector parsed as UiSelector
|
|
161
163
|
*/
|
|
162
164
|
function parsePseudo(cssPseudo) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
// @ts-ignore We only care for strings
|
|
166
|
+
const argValue = cssPseudo.argument?.value;
|
|
167
|
+
if (!lodash_1.default.isString(argValue) && !lodash_1.default.isEmpty(argValue)) {
|
|
168
|
+
throw new TypeError(`'${cssPseudo.name}=${argValue}'. ` +
|
|
169
|
+
`Unsupported css pseudo class value: '${argValue}'. Only 'string' type or empty is supported.`);
|
|
166
170
|
}
|
|
167
|
-
const pseudoName =
|
|
171
|
+
const pseudoName = requireEntityName(cssPseudo);
|
|
168
172
|
if (BOOLEAN_ATTRS.includes(pseudoName)) {
|
|
169
173
|
return `${toCamelCase(pseudoName)} == ${requireBoolean(cssPseudo)}`;
|
|
170
174
|
}
|
|
171
175
|
if (pseudoName === 'index') {
|
|
172
|
-
return { index:
|
|
176
|
+
return { index: argValue };
|
|
173
177
|
}
|
|
174
178
|
}
|
|
175
|
-
/**
|
|
176
|
-
* @typedef {Object} CssRule
|
|
177
|
-
* @property {string} [nestingOperator] The nesting operator (aka: combinator https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors)
|
|
178
|
-
* @property {string} [tagName] The tag name (aka: type selector https://developer.mozilla.org/en-US/docs/Web/CSS/Type_selectors)
|
|
179
|
-
* @property {string[]} [classNames] An array of CSS class names
|
|
180
|
-
* @property {CssAttr[]} [attrs] An array of CSS attributes
|
|
181
|
-
* @property {CssPseudo[]} [pseudos] An array of CSS pseudos
|
|
182
|
-
* @property {string} [id] CSS identifier
|
|
183
|
-
* @property {CssRule} [rule] A descendant of this CSS rule
|
|
184
|
-
*/
|
|
185
179
|
/**
|
|
186
180
|
* Convert a CSS rule to a UiSelector
|
|
187
|
-
* @param {
|
|
181
|
+
* @param {import('css-selector-parser').AstRule} cssRule CSS rule definition
|
|
188
182
|
*/
|
|
189
183
|
function parseCssRule(cssRule) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
throw new Error(`'${nestingOperator}' is not a supported combinator. ` +
|
|
184
|
+
if (cssRule.combinator && ![' ', '>'].includes(cssRule.combinator)) {
|
|
185
|
+
throw new Error(`'${cssRule.combinator}' is not a supported combinator. ` +
|
|
193
186
|
`Only child combinator (>) and descendant combinator are supported.`);
|
|
194
187
|
}
|
|
195
188
|
let iosClassChainSelector = '';
|
|
@@ -198,67 +191,47 @@ function parseCssRule(cssRule) {
|
|
|
198
191
|
is not a valid ios class. Must be a single string (e.g.: XCUIElementTypeWindow) without
|
|
199
192
|
dots separating them`);
|
|
200
193
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
194
|
+
// @ts-ignore name presense
|
|
195
|
+
let tagName = cssRule.tag?.name ?? '';
|
|
196
|
+
if (tagName && tagName !== '*' && !lodash_1.default.startsWith(lodash_1.default.toLower(tagName), 'xcuielementtype')) {
|
|
197
|
+
const capitalizedTagName = tagName.charAt(0).toUpperCase() + tagName.slice(1);
|
|
198
|
+
tagName = `XCUIElementType${capitalizedTagName}`;
|
|
204
199
|
}
|
|
205
|
-
iosClassChainSelector += (
|
|
206
|
-
|
|
207
|
-
if (cssRule.
|
|
208
|
-
attrs.push(`name == "${cssRule.
|
|
200
|
+
iosClassChainSelector += (tagName || '*');
|
|
201
|
+
const attrs = [];
|
|
202
|
+
if (cssRule.ids && !lodash_1.default.isEmpty(cssRule.ids)) {
|
|
203
|
+
attrs.push(`name == "${cssRule.ids[0]}"`);
|
|
209
204
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
attrs.push(parseAttr(attr));
|
|
213
|
-
}
|
|
205
|
+
for (const attr of cssRule.attributes ?? []) {
|
|
206
|
+
attrs.push(parseAttr(attr));
|
|
214
207
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
attrs.push(parsePseudo(pseudo));
|
|
218
|
-
}
|
|
208
|
+
for (const pseudo of cssRule.pseudoClasses ?? []) {
|
|
209
|
+
attrs.push(parsePseudo(pseudo));
|
|
219
210
|
}
|
|
220
211
|
const nonIndexAttrs = attrs.filter((attr) => lodash_1.default.isString(attr));
|
|
221
|
-
if (nonIndexAttrs
|
|
212
|
+
if (!lodash_1.default.isEmpty(nonIndexAttrs)) {
|
|
222
213
|
iosClassChainSelector += `[\`${nonIndexAttrs.join(' AND ')}\`]`;
|
|
223
214
|
}
|
|
224
215
|
const indexAttr = attrs.find((attr) => lodash_1.default.isObject(attr) && attr.index);
|
|
225
216
|
if (indexAttr) {
|
|
226
217
|
iosClassChainSelector += `[${ /** @type { {index: string} } */(indexAttr).index}]`;
|
|
227
218
|
}
|
|
228
|
-
if (cssRule.
|
|
229
|
-
iosClassChainSelector += `/${parseCssRule(cssRule.
|
|
230
|
-
}
|
|
231
|
-
if (cssRule.nestingOperator === '>') {
|
|
232
|
-
return iosClassChainSelector;
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
return `**/` + iosClassChainSelector;
|
|
219
|
+
if (cssRule.nestedRule) {
|
|
220
|
+
iosClassChainSelector += `/${parseCssRule(cssRule.nestedRule)}`;
|
|
236
221
|
}
|
|
222
|
+
return cssRule.combinator === '>' ? iosClassChainSelector : `**/${iosClassChainSelector}`;
|
|
237
223
|
}
|
|
238
|
-
/**
|
|
239
|
-
* @typedef {Object} CssObject
|
|
240
|
-
* @property {string} [type] Type of CSS object. 'rule', 'ruleset' or 'selectors'
|
|
241
|
-
*/
|
|
242
224
|
/**
|
|
243
225
|
* Convert CSS object to iOS Class Chain selector
|
|
244
|
-
*
|
|
226
|
+
*
|
|
227
|
+
* @param {import('css-selector-parser').AstSelector} css CSS object
|
|
245
228
|
* @returns {string} The CSS object parsed as a UiSelector
|
|
246
229
|
*/
|
|
247
230
|
function parseCssObject(css) {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
// @ts-expect-error this is extremely broken
|
|
251
|
-
return parseCssRule(css);
|
|
252
|
-
case 'ruleSet':
|
|
253
|
-
// @ts-expect-error this is extremely broken
|
|
254
|
-
return parseCssObject(css.rule);
|
|
255
|
-
case 'selectors':
|
|
256
|
-
// @ts-expect-error this is extremely broken
|
|
257
|
-
return css.selectors.map((selector) => parseCssObject(selector)).join('; ');
|
|
258
|
-
default:
|
|
259
|
-
// This is never reachable, but if it ever is do this.
|
|
260
|
-
throw new Error(`iOS Class Chain does not support '${css.type}' css. Only supports 'rule', 'ruleSet', 'selectors'`);
|
|
231
|
+
if (!lodash_1.default.isEmpty(css.rules)) {
|
|
232
|
+
return parseCssRule(css.rules[0]);
|
|
261
233
|
}
|
|
234
|
+
throw new Error('No rules could be parsed out of the current selector');
|
|
262
235
|
}
|
|
263
236
|
/**
|
|
264
237
|
* Convert a CSS selector to a iOS Class Chain selector
|
|
@@ -268,15 +241,17 @@ function parseCssObject(css) {
|
|
|
268
241
|
CssConverter.toIosClassChainSelector = function toIosClassChainSelector(cssSelector) {
|
|
269
242
|
let cssObj;
|
|
270
243
|
try {
|
|
271
|
-
cssObj =
|
|
244
|
+
cssObj = parseCssSelector(cssSelector);
|
|
272
245
|
}
|
|
273
246
|
catch (e) {
|
|
247
|
+
logger_js_1.default.debug(e.stack);
|
|
274
248
|
throw new driver_1.errors.InvalidSelectorError(`Invalid CSS selector '${cssSelector}'. Reason: '${e.message}'`);
|
|
275
249
|
}
|
|
276
250
|
try {
|
|
277
251
|
return parseCssObject(cssObj);
|
|
278
252
|
}
|
|
279
253
|
catch (e) {
|
|
254
|
+
logger_js_1.default.debug(e.stack);
|
|
280
255
|
throw new driver_1.errors.InvalidSelectorError(`Unsupported CSS selector '${cssSelector}'. Reason: '${e.message}'`);
|
|
281
256
|
}
|
|
282
257
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-converter.js","sourceRoot":"","sources":["../../lib/css-converter.js"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"css-converter.js","sourceRoot":"","sources":["../../lib/css-converter.js"],"names":[],"mappings":";;;;;AAAA,6DAAmD;AACnD,oDAAuB;AACvB,0CAAuC;AACvC,4DAA8B;AAE9B,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,MAAM,gBAAgB,GAAG,IAAA,kCAAY,EAAC;IACpC,MAAM,EAAE;QACN,aAAa,EAAE;YACb,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE;gBACX,QAAQ,EAAE,CAAC,KAAK,CAAC;aAClB;SACF;QACD,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;QAC5B,UAAU,EAAE;YACV,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC;SACzC;QACD,GAAG,EAAE,IAAI;QACT,UAAU,EAAE,IAAI;QAChB,GAAG,EAAE;YACH,QAAQ,EAAE,IAAI;SACf;KACF;IACD,WAAW,EAAE,IAAI;CAClB,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG;IACpB,SAAS,EAAE,YAAY,EAAE,yBAAyB,EAAE,SAAS;CAC9D,CAAC;AAEF,MAAM,aAAa,GAAG;IACpB,OAAO;CACR,CAAC;AAEF,MAAM,SAAS,GAAG;IAChB,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