We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 506a349 commit 4f8ed3cCopy full SHA for 4f8ed3c
1 file changed
pages/BasePage.ts
@@ -124,4 +124,22 @@ export class BasePage {
124
const submitButton = this.page.getByRole('button', { name: buttonName, exact: true });
125
await this.clickElement(submitButton);
126
}
127
+
128
+ public async clickAndChooseFromDropdownByText(
129
+ dropdownLocator: (string | Locator),
130
+ dropdownList: Locator,
131
+ dropdownItemText: string,
132
+ ) {
133
+ await this.clickElement(dropdownLocator);
134
+ await this.page.waitForTimeout(2000);
135
+ const dropDownList = await dropdownList.all();
136
+ for (let item of dropDownList) {
137
+ const itemText = await this.getInnerText(item);
138
+ if (itemText === dropdownItemText) {
139
+ await item.click();
140
+ return;
141
+ }
142
143
+ throw new Error(`the item ${dropdownItemText} does not exist in dropdown!`);
144
145
0 commit comments