Dealing with Customized Dropdowns

What if you use custom dropdown instead of native <select>? In this case selectOption won’t work.
And you will need to create your own function inside steps_file.

An example of such function. It should be customized depending on your HTML markup and dropdown control used:

    selectInDropdown(dropdown, value) {
      this.click(dropdown);
      // wait for dropdown list to appear
      this.waitForVisible(`//span[@type='button']//div[contains(text(), '${value}')]`); 
      // click on it
      this.click(`//span[@type='button']//div[contains(text(), '${value}')]`);
    },
3 Likes