In cases where the element identifier is not predefined, the CSS class can be used as a valid selector. This, of course, applies if there is only one element with this class on the page. For several elements, I would suggest that you mark each of them with a different css class, for example:
<button class="yes btn btn-default" id="868d2d8a-67f6-4308-a3c8-0246a5d4618c">Yes</button> <button class="no btn btn-default" id="23e4d027-ef32-4b58-b8b6-6f95bead2db4">No</button>
and then you can use a simple CSS selector like
button.btn-default.yes
to achieve the desired element using selenium.
source share