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
While we are using CodeceptJS with test framework helpers, the main entity for a DOM object is not exposed.
These are referred to as different names in frameworks. ElementHandle for Playwright, WebElement for WebDriverIO, ElementFinder for Protractor etc...
CodeceptJS currently is swallowing this exposure and only accepting locator parameters to the wrapped assertion methods such as I.click('#submit');. Whereas we should be able to locate element(s) and should be able to perform desired actions on these element(s) accordingly.
A common use case can be:
locate multiple elements matching the selector criteria in the page
populate them in an Array
perform a check for an attribute value on all these elements using a loop.
find the matching one
perform a click action on that specific element or any further test.
with current design we can only use a hack like below to perform this action (using Playwright for this example):
create a variable in :any type
find the element using I.usePlayWrightTo(...., ({page}) => { this.localElm = page.$$(...) });
then loop to find your match, again using I.usePlayWrightTo(...., ({page}) => { this.localElm.foreach(elm => (elm. getProperty(....)........
This class should bind according to the chosen helper and shall allow us to be exposed to further methods of DOMElement such as getProperty, getInnerHtml, getBoundingBox etc... further more, it will also allow us to perform additional searches within the element, such as: elm.$ or elm.$$....
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
-
While we are using CodeceptJS with test framework helpers, the main entity for a DOM object is not exposed.
These are referred to as different names in frameworks.
ElementHandle
for Playwright,WebElement
for WebDriverIO,ElementFinder
for Protractor etc...CodeceptJS currently is swallowing this exposure and only accepting locator parameters to the wrapped assertion methods such as
I.click('#submit');
. Whereas we should be able to locate element(s) and should be able to perform desired actions on these element(s) accordingly.A common use case can be:
with current design we can only use a hack like below to perform this action (using Playwright for this example):
:any
typeI.usePlayWrightTo(...., ({page}) => { this.localElm = page.$$(...) });
I.usePlayWrightTo(...., ({page}) => { this.localElm.foreach(elm => (elm. getProperty(....)........
This class should bind according to the chosen helper and shall allow us to be exposed to further methods of DOMElement such as getProperty, getInnerHtml, getBoundingBox etc... further more, it will also allow us to perform additional searches within the element, such as: elm.$ or elm.$$....
Beta Was this translation helpful? Give feedback.
All reactions