Fill in python/ Selenium form

Asked

Viewed 218 times

0

I’m trying to fill out a form with python/Selenium but I can’t find the element to send the text. I can’t list the whole form, it’s private...

Form:

<td class="ml-FldCnt lo_22565 ml-BrdBottom" colspan="4" style="width:85%;">
<span id="master_DefaultContent_rts_ts3850_s3851_f18613c_wrapper" class="riSingle RadInput RadInput_archer autoWidth" style="width:100%;">
<input id="master_DefaultContent_rts_ts3850_s3851_f18613c" name="master$DefaultContent$rts$ts3850$s3851$f18613c" size="20" class="riTextBox riEnabled" aria-labelledby="loitem22565" type="text" value="">
<input id="master_DefaultContent_rts_ts3850_s3851_f18613c_ClientState" name="master_DefaultContent_rts_ts3850_s3851_f18613c_ClientState" type="hidden" autocomplete="off" value="{&quot;enabled&quot;:true,&quot;emptyMessage&quot;:&quot;&quot;,&quot;validationText&quot;:&quot;&quot;,&quot;valueAsString&quot;:&quot;&quot;,&quot;lastSetTextBoxValue&quot;:&quot;&quot;}"></span>
</td>

I’ve used several codes to locate the input field and throw the text in, but nothing worked..

Down with the last code I tried:

titulo = self.driver.find_element_by_xpath('//*@id="master_DefaultContent_rts_ts3850_s3851_f18613c"]')
titulo.clear()
titulo.send_keys(self.titulo_sol)
titulo.send_keys(Keys.TAB)
sleep(10)

Upshot:

Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="master_DefaultContent_rts_ts3850_s3851_f18613c"]"}

Does anyone know a way to access the input field?

Thank you.

  • You tried the find_element_by_id?

  • yes. this page has javascript. I think something of it interferes with the search.In a quick test, when I pass the mouse cursor in the title field, a property changes situation. class="riTextBox riEnabled" changes to class="riTextBox riEnabled riHover".

  • 1

    Guys, I found a way: self.driver.switch_to.frame("record-1093-iframeEl"). I focused on the frame where the input is and worked. found the input and filled in its contents correctly. thanks to all.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.