In the following,

```
<section id="section2" class="MightChange1 MightChange2">
   <div id="dynamicIdxxx" class="dynamic1 dynamic2 dynamic3">
     <div id="againDynamic" ..>
         <div id="someDynamicCanBeRelayed" class="xyz">
         <button id="dynmaicBtnxx" class="Cannot be relayed">
             <span ....>
                  <span id="dynamic23" class="PartOfDoesntChange">
                       <bdi> show INTEGER more details</bdi>

```

How to select the span (with id=dynamic23) using text of bdi (which INTEGER changes). 

I could write like following
//\*[@id='section2']//span/bdi[contains(text(),'more fields')]/ancestor::button")

The challenge is, sometimes below 

```
<span id="dynamic23" class="PartOfDoesntChange">
     <bdi> show INTEGER more details</bdi>

```

will be changed to (without bdi tag)

```
<span id="dynamic23" class="PartOfDoesntChange"> show INTEGER more details <span>

```

One option to handle is I can use two xpath's with and without bdi using selenium OR conditions. Either way, I would get the result and use that element.

Is there any better alternatives for such scenarios or by using css selectors?