-1

I'm trying to get to "input" so that I can enter the values, knowing that the value of the ID is constantly changing

<div>
    <idms-error-wrapper {^error-type}="errorType" {^idms-error-wrapper-classes}="idmsErrorWrapperClasses"

            <div class=" form-element ">
                <input errors="{errors}" {^has-errors}="hasErrors" {$value}="value"
                       {$aria-required}="isRequired" type="text"
                       class="form-cell form-textbox form-textbox-text form-field"
                       id="input-1647425309700-0" value="" aria-required="true">
            </div>
            
    </idms-error-wrapper>
</div> 

2 Answers2

0

In case 1647425309700 or 1647425309700-0 is variable here you can use something like this:

input_id = 1647425309700
input_xpath = "//input[contains(@id,'"+ str(input_id) +"')]"
driver.find_element(By.XPATH,input_xpath)
Prophet
  • 32,350
  • 22
  • 54
  • 79
0

The <id> attribute of the <input> tag, i.e. input-1647425309700-0 is dynamically generated and will change everytime you would access the page afresh. So identify the desired element you can use either of the the following locator strategies:

  • css_selector:

    input.form-cell.form-textbox.form-textbox-text.form-field[id^='input'][aria-required='true'][value]
    
  • xpath:

    //input[@class='form-cell form-textbox form-textbox-text form-field' and starts-with(@id, 'input')][@aria-required='true' and @value]
    

Reference

You can find a relevant detailed discussion in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352