You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a table with following structure and I want to get text inside "p" tag. Text can be empty. In such cases I.grabTextFrom() fails with ElementNotFound exception. I was expecting it to return "" (empty string). Even the try catch block won't catch this exception. Any workaround for this issue?
let element = { xpath: `//p[text()='${fieldName}']/following::p` };
try {
// I see element passes fine
I.seeElement(element);
return await I.grabTextFrom(element);
} catch (error) {
return "";
}
Error
Element "xpath=//p[text()='Field2']/following::p" was not found by text|CSS|XPath
at new ElementNotFound (node_modules/codeceptjs/lib/helper/errors/ElementNotFound.js:15:11)
at assertElementExists (node_modules/codeceptjs/lib/helper/Playwright.js:3742:11)
at Playwright.grabTextFrom (node_modules/codeceptjs/lib/helper/Playwright.js:2089:5)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a table with following structure and I want to get text inside "p" tag. Text can be empty. In such cases I.grabTextFrom() fails with ElementNotFound exception. I was expecting it to return "" (empty string). Even the try catch block won't catch this exception. Any workaround for this issue?
Sample HTML
Code to grabtext
Error
Codeceptjs: 3.6.5
Browser: chromium
Helper: Playwright
Beta Was this translation helpful? Give feedback.
All reactions