title: Selecting dynamic input box in Salesforce - Selenium/ Python
body: <p>How can I select the following input box (id=2258:0) with Selenium for python? The id dynamically changes as well as other elements.</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;label class="label inputLabel uiLabel-left form-element__label uiLabel" for="2258:0" data-aura-rendered-by="3789:0" data-aura-class="uiLabel"&gt;&lt;span class="" data-aura-rendered-by="3790:0"&gt;Close Date&lt;/span&gt;&lt;div class="tooltip-trigger uiTooltip" aria-describedby="tt-for-2283:0" tabindex="0" data-aura-rendered-by="2286:0" data-aura-class="uiTooltip" data-proxy-id="aura-pos-lib-4" id="2286:0"&gt;&lt;lightning-icon class="tooltipIcon slds-button__icon slds-icon-utility-info slds-icon_container forceIcon" data-data-rendering-service-uid="963" data-aura-rendered-by="2282:0" data-aura-class="forceIcon"&gt;&lt;lightning-primitive-icon lightning-primitiveicon_primitiveicon-host=""&gt;&lt;svg lightning-primitiveIcon_primitiveIcon="" focusable="false" data-key="info" aria-hidden="true" class="slds-icon slds-icon_xx-small"&gt;&lt;use lightning-primitiveIcon_primitiveIcon="" xlink:href="/_slds/icons/utility-sprite/svg/symbols.svg?cache=9.26.0#info"&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/lightning-primitive-icon&gt;&lt;/lightning-icon&gt;&lt;span class="tooltip-invisible" role="tooltip" id="tt-for-2283:0" data-aura-rendered-by="2288:0"&gt;Date the Opportunity Product isClosed&lt;/span&gt;&lt;/div&gt;&lt;!--render facet: 3793:0--&gt;&lt;/label&gt;
      &lt;div class="tooltip-trigger uiTooltip" aria-describedby="tt-for-2283:0" tabindex="0" data-aura-rendered-by="2286:0" data-aura-class="uiTooltip" data-proxy-id="aura-pos-lib-4" id="2286:0"&gt;&lt;lightning-icon class="tooltipIcon slds-button__icon slds-icon-utility-info slds-icon_container forceIcon" data-data-rendering-service-uid="963" data-aura-rendered-by="2282:0" data-aura-class="forceIcon"&gt;&lt;lightning-primitive-icon lightning-primitiveicon_primitiveicon-host=""&gt;&lt;svg lightning-primitiveIcon_primitiveIcon="" focusable="false" data-key="info" aria-hidden="true" class="slds-icon slds-icon_xx-small"&gt;&lt;use lightning-primitiveIcon_primitiveIcon="" xlink:href="/_slds/icons/utility-sprite/svg/symbols.svg?cache=9.26.0#info"&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/lightning-primitive-icon&gt;&lt;/lightning-icon&gt;&lt;span class="tooltip-invisible" role="tooltip" id="tt-for-2283:0" data-aura-rendered-by="2288:0"&gt;Date the Opportunity Product isClosed&lt;/span&gt;&lt;/div&gt;
          &lt;lightning-icon class="tooltipIcon slds-button__icon slds-icon-utility-info slds-icon_container forceIcon" data-data-rendering-service-uid="963" data-aura-rendered-by="2282:0" data-aura-class="forceIcon"&gt;&lt;lightning-primitive-icon lightning-primitiveicon_primitiveicon-host=""&gt;&lt;svg lightning-primitiveIcon_primitiveIcon="" focusable="false" data-key="info" aria-hidden="true" class="slds-icon slds-icon_xx-small"&gt;&lt;use lightning-primitiveIcon_primitiveIcon="" xlink:href="/_slds/icons/utility-sprite/svg/symbols.svg?cache=9.26.0#info"&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/lightning-primitive-icon&gt;&lt;/lightning-icon&gt;
          &lt;span class="tooltip-invisible" role="tooltip" id="tt-for-2283:0" data-aura-rendered-by="2288:0"&gt;Date the Opportunity Product isClosed&lt;/span&gt;
          &lt;div class="tooltip-trigger uiTooltip" aria-describedby="tt-for-2283:0" tabindex="0" data-aura-rendered-by="2286:0" data-aura-class="uiTooltip" data-proxy-id="aura-pos-lib-4" id="2286:0"&gt;&lt;lightning-icon class="tooltipIcon slds-button__icon slds-icon-utility-info slds-icon_container forceIcon" data-data-rendering-service-uid="963" data-aura-rendered-by="2282:0" data-aura-class="forceIcon"&gt;&lt;lightning-primitive-icon lightning-primitiveicon_primitiveicon-host=""&gt;&lt;svg lightning-primitiveIcon_primitiveIcon="" focusable="false" data-key="info" aria-hidden="true" class="slds-icon slds-icon_xx-small"&gt;&lt;use lightning-primitiveIcon_primitiveIcon="" xlink:href="/_slds/icons/utility-sprite/svg/symbols.svg?cache=9.26.0#info"&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/lightning-primitive-icon&gt;&lt;/lightning-icon&gt;&lt;span class="tooltip-invisible" role="tooltip" id="tt-for-2283:0" data-aura-rendered-by="2288:0"&gt;Date the Opportunity Product isClosed&lt;/span&gt;&lt;/div&gt;
  
  &lt;div class="form-element" data-aura-rendered-by="2262:0"&gt;&lt;input class=" input" type="text" aria-describedby="" id="2258:0" data-aura-rendered-by="2263:0" data-interactive-lib-uid="16" data-proxy-id="aura-pos-lib-13"&gt;&lt;a class="datePicker-openIcon display" aria-haspopup="true" data-aura-rendered-by="2265:0" href="javascript:void(0);"&gt;&lt;span class="assistiveText" data-aura-rendered-by="2266:0"&gt;Date Picker&lt;/span&gt;&lt;/a&gt;&lt;!--render facet: 2268:0--&gt;&lt;!--render facet: 2269:0--&gt;&lt;/div&gt;
      &lt;input class=" input" type="text" aria-describedby="" id="2258:0" data-aura-rendered-by="2263:0" data-interactive-lib-uid="16" data-proxy-id="aura-pos-lib-13"&gt;
      &lt;a class="datePicker-openIcon display" aria-haspopup="true" data-aura-rendered-by="2265:0" href="javascript:void(0);"&gt;&lt;span class="assistiveText" data-aura-rendered-by="2266:0"&gt;Date Picker&lt;/span&gt;&lt;/a&gt;
  
  </code></pre>
  
  <p>I've tried the following code with no success:</p>
  
  <pre class="lang-py prettyprint-override"><code>driver.find_element_by_xpath("//*[contains(text(), 'Close Date')]/following-sibling::input")
  </code></pre>