mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix(Page.select): assert all values are of type "string". (#1280)
This patch starts asserting that all values are of type "string". The alternative approach to cast values to strings might yield a hard-to-debug errors. Fixes #1276.
This commit is contained in:
@@ -418,6 +418,8 @@ class Frame {
|
||||
* @return {!Promise<!Array<string>>}
|
||||
*/
|
||||
async select(selector, ...values){
|
||||
for (const value of values)
|
||||
console.assert(helper.isString(value), 'Values must be strings. Found value "' + value + '" of type "' + (typeof value) + '"');
|
||||
return await this.$eval(selector, (element, values) => {
|
||||
if (element.nodeName.toLowerCase() !== 'select')
|
||||
throw new Error('Element is not a <select> element.');
|
||||
|
||||
Reference in New Issue
Block a user