diff --git a/lib/helper/Puppeteer.js b/lib/helper/Puppeteer.js index 7102f35da..ffd12551a 100644 --- a/lib/helper/Puppeteer.js +++ b/lib/helper/Puppeteer.js @@ -2271,7 +2271,7 @@ class Puppeteer extends Helper { const els = await this._locate(locator) const array = [] for (let index = 0; index < els.length; index++) { - const a = await this._evaluateHandeInContext((el, attr) => el[attr] || el.getAttribute(attr), els[index], attr) + const a = await this._evaluateHandeInContext((el, attr) => (attr === 'style' ? el.getAttribute(attr) : el[attr] || el.getAttribute(attr)), els[index], attr) array.push(a) } return array diff --git a/test/helper/webapi.js b/test/helper/webapi.js index 9f1b08ad9..bde263077 100644 --- a/test/helper/webapi.js +++ b/test/helper/webapi.js @@ -1469,6 +1469,12 @@ export function tests() { assert.equal(val, 'oldfag') }) + it('should grab full style attribute', async () => { + await I.amOnPage('/form/example1') + const style = await I.grabAttributeFrom('#LoginForm_username_em_', 'style') + assert.equal(style, 'display:none') + }) + it('should grab attribute from element', async () => { await I.amOnPage('/search') const val = await I.grabAttributeFrom(