I want to make a Python program with Selenium to fill out a form. Part of the process involves filling out a title. I used xpath to find the input associated with title, but then found out that it only works sometimes because its id is dynamic and keeps changing. Here is the html code associated with the title input box:
<div class='g5ia77ul buofh1pr d2edcug0 l9j0dhe7'>
<span class="m9osqain t5a262vz a8c37x1j b5fwa0m2 jagab5yi knj5qynh fo6rh5oj d2edcug0 ni8dbmo4 stjgntxs hzruof5a pmk7jnqg re5koujm ltmttdrg fgv6swy9 dd2scrzq ms05siws flx89l3n b7h9ocf4 g0qnabr5">Title</span>
<input dir="auto" aria-invalid="false" id="jsc_c_6" class="oajrlxb2 rq0escxv f1sip0of hidtqoto lzcic4wl g5ia77u1 gcieejh5 bn081pho humdl8nn izx4hr6d oo9gr5id qc3s4z1d knj5qynh fo6rh5oj osnr6wyh hv4rvrfc dati1w0a p0x8y401 k4urcfbm iu8raji3" type="text" value="">
</div>
Other boxes in the form have similar id, they all seem to start with "jsc_c_" like "jsc_c_a" or "jsc_c_8". Here is a picture of what part of the form looks like:
[
][1
This is some of the code I have tried to select the title box:
titlePath = '//*[@id="jsc_c_6"]'
titleText = 'myTitle'
titleBox = driver.find_element_by_xpath(titlePath)
titleBox.send_keys(titleText)
I think that perhaps I could select the title input box by checking for the presence of the text "Title" in the box. However, I am not sure how this can be done. Any help or suggestions would be greatly appreciated.