I am working with Webdriver in Typescript. I am trying to create a formula that will click on an element based on the name of the Span text. I have found some advice, but the answers I found deal with a static span name instead of one that varies depending on what a user enters in the formula.
The selector 'span:contains("Groupname")' should select the dropdown option with Groupname, at least it does so when I run it with a .click() in the web console.
Below is the updated code since when I first posted this question
public async recipientGroupSelection(group: string) : Promise<void> {
let RecipientsDropdown: Element<'async'> = await this.RecipientsDropdown();
await RecipientsDropdown.click();
await this.browser.pause(500);
let recipientInput : Element<'async'> = await this.selector('span:contains("' +group +'")');
await recipientInput.click();
}
The problem is the scrip return an error stating that 'span:contains("Medic")' is not a valid selector. Do you know what change I can make to this code so that this will function? Is there a better selector method to use here?