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
When attempting to use the find(...) (or see(...)) action helper, I'm unable to select a specific element when multiple are found on the page. Instead, I would be presented with the following error:
> see('Aug 26, 2019');
> "Looking for Aug 26, 2019 failed. More than one element is displayed, number of displayed elements: 8
Elements:
<td _ngcontent-wup-c43="" class="mat-cell cdk-column-created mat-column-created ng-star-inserted" mat-cell="" role="gridcell">Aug 26, 2019</td>
<td _ngcontent-wup-c43="" class="mat-cell cdk-column-created mat-column-created ng-star-inserted" mat-cell="" role="gridcell">Aug 26, 2019</td>
<td _ngcontent-wup-c43="" class="mat-cell cdk-column-created mat-column-created ng-star-inserted" mat-cell="" role="gridcell">Aug 26, 2019</td>
...
"
Solution
Update the findGlobal(locator) function to look for a new property on the locator, e.g. locator.index and/or locator.wantMultiple
Update the opt_options of browserSideFind(locators, opt_options) to include the new property
Update retrying_find to return the new possible type of WebElement[]
Update BrowserSideOptions with the new property (e.g. locator.wantMultiple)
Update getElement(locator: FlexibleLocator, description: string): Promise<WebElement> to also accept and use options: BrowserSideOptions and return Promise<WebElement|WebElement[]>
Ultimately, this would result in the end user having the following experience:
Alternatively, you could always pass in the option {wantMultiple: true} for find(...), thus providing the following experience:
find('Aug 26 2019')[2].click();// or// Default return the first element if the WebElement[] length is equal to 1 (backwards compatibility)find('Aug 26 2019');// orconstdates=below('Created').find('Aug 26, 2019');expect(dates.length).toBe(8);
Problem
When attempting to use the
find(...)
(orsee(...)
) action helper, I'm unable to select a specific element when multiple are found on the page. Instead, I would be presented with the following error:Solution
findGlobal(locator)
function to look for a new property on the locator, e.g.locator.index
and/orlocator.wantMultiple
opt_options
ofbrowserSideFind(locators, opt_options)
to include the new propertyretrying_find
to return the new possible type ofWebElement[]
BrowserSideOptions
with the new property (e.g.locator.wantMultiple
)getElement(locator: FlexibleLocator, description: string): Promise<WebElement>
to also accept and useoptions: BrowserSideOptions
and returnPromise<WebElement|WebElement[]>
Ultimately, this would result in the end user having the following experience:
The text was updated successfully, but these errors were encountered: