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?
If you are sure that the first value(Select one:) is always not needed, you can just substring the string.
yourString.subtring(yourString.IndexOf(",")+1)
@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!!