Skip to content

Commit

Permalink
Log error message if we cannot add text to the element (#2136)
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore committed May 24, 2024
1 parent 083e99a commit b2af806
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions lib/core/engine/command/addText.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ export class AddText {
await element.clear();
return element.sendKeys(text);
} catch (error) {
log.error('Could not add text %s to id %s', text, id);
log.error(
'Could not add text %s to id %s error:%s',
text,
id,
error.message
);
log.verbose(error);
throw new Error(`Could not add text ${text} to id ${id}`);
}
Expand All @@ -57,7 +62,12 @@ export class AddText {
await element.clear();
return element.sendKeys(text);
} catch (error) {
log.error('Could not add text %s to xpath %s', text, xpath);
log.error(
'Could not add text %s to xpath %s error: %s',
text,
xpath,
error.message
);
log.verbose(error);
throw new Error(`Could not add text ${text} to xpath ${xpath}`);
}
Expand All @@ -81,7 +91,12 @@ export class AddText {
await element.clear();
return element.sendKeys(text);
} catch (error) {
log.error('Could not add text %s to selector %s', text, selector);
log.error(
'Could not add text %s to selector %s error: %s',
text,
selector,
error.message
);
log.verbose(error);
throw new Error(`Could not add text ${text} to selector ${selector}`);
}
Expand All @@ -105,7 +120,12 @@ export class AddText {
await element.clear();
return element.sendKeys(text);
} catch (error) {
log.error('Could not add text %s to class name %s', text, className);
log.error(
'Could not add text %s to class name %s error: %s',
text,
className,
error.message
);
log.verbose(error);
throw new Error(`Could not add text ${text} to class name ${className}`);
}
Expand All @@ -129,7 +149,12 @@ export class AddText {
await element.clear();
return element.sendKeys(text);
} catch (error) {
log.error('Could not add text %s to name attribute %s', text, name);
log.error(
'Could not add text %s to name attribute %s error: %s',
text,
name,
error.message
);
log.verbose(error);
throw new Error(`Could not add text ${text} to name attribute ${name}`);
}
Expand Down

0 comments on commit b2af806

Please sign in to comment.