How to remove header text (like - Select one:) while fetching options from Drop-down list

Hi Team,

I am using get attribute and select “inner text” from there to fetch all the values in the drop-down list and then taking all the values in a single string variable by appending with ‘,’ after each available options [dropdownOptions.Replace(" ", “,”)].

Output string I am getting as -
Select one:, A, B, C, D, …

Here ‘Select one:’ is the header text which appears by-default in the drop-down list and it is also getting appended as list of option values along with others.

Can anyone please suggest how to remove this initial header from the list of available options?

Expected Output is : A, B, C, D,…


How about the following?

yourString.Replace("Select one:,","")





If you are sure that the first value(Select one:) is always not needed, you can just substring the string.

1 Like

@Yoichi … Thanks for your response.
This is working when header text is “Select one:”, but sometimes it varies as well.
I am able to do with the solution @chandu4712 suggested below.
But appreciate for your suggestion though!!

@chandu4712 … Thanks for your response.
This is exactly what I was looking for. By identifying the index I am able to remove 1st value and get rest of the require values.
Thanks a ton Man!!

1 Like

I am glad to hear that.
Everyone here in the forum is very helpful.
I learnt everything from the Forum and i am just giving back my best.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.