I need to extract the text from the span element ( Afghanistan ), but when I try using the path for the span (
//span[@class=‘mat-option-text’]
), it also includes the text from the mat-icon ( warning ).
The current output displayed in the console is:
Afghanistan warning
Is there a way to only print Afghanistan without the additional text?