Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log error message if we cannot add text to the element #2136

Merged
merged 1 commit into from
May 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading