I have a selenium code (using python) that select a value in a dropdown using the select_by_value method of the 'Select' package in selenium.
As you can see in the picture, I input the value 1
in the code and it selects "Poste" which is the text associated with the value 1
.
My question is if there is a way to get the value that was selected after the select process.
I know that with the first_selected_option method I can go get the text of the option selected with :
selected_value = options_com.first_selected_option
sv = selected_value.text
print(sv)
So is there a way to return the value selected, in this exemple the value = "1"
, instead of the text.