I am using selenium in python to scrape a web page designed with angular js and hence has no robust identifiers for elements such as id etc. I am completely reliant on CSS selectors (which are dynamic) and xpaths.
I have the following code -
<div class="dpm-form-row ng-star-inserted">
<dpm-input-number class="flex-6">
<dpm-input-label>
<label>Fixed Rate</label>
</dpm-input-label>
<dpm-input-number-bare>
<input size="1" type="text" placeholder="" class="ng-pristine ng-valid ng-touched">
</dpm-input-number-bare>
</dpm-input-number>
<div class="flex-6">
</div>
</div>
It's basically a label called "Fixed Rate" followed by an input text box. Its that box I am trying to grab.
I have managed to get the label using the following code, I am having trouble using the parent/sibling logic to get the box -
element = driver.find_element_by_xpath('//*[contains(text(),"Fixed Rate")]')