You can create an enum variable and set it based on the string. In the xpath you can then compare with the enum variable instead of the string.
You can’t change an enum at runtime. The enum values are always hard coded. I don’t think an enum is what solves your problem.
You need to be able to select one object in a dropdown. Why don’t you use an association between the object shown in your page (or a helper object that you create to do this) and a reference selector. The reference selector can be a dropdown that is dynamic and shows all possible values from the DB.
I have solve the problem.
because the enumeration can not compare with string type directly. there two methods to solve it.