0

I'm trying to insert a value into a text box located in a web page.

Text box appears at the bottom of the web page and the element is not locatable by the code. I should Inspect two times to see the table value in Chrome (first time it shows a different/parent HTML all together) that suggests us that there are multiple layers and requires finding in deep.

I've tried inserting the string as shown below..

driver.find_element_by_id("arid1005").send_keys("TESTING")

and

elem = driver.find_element_by_id("arid1005")
driver.execute_script('arguments[0].value = "TESTING";',elem)

I've also tried finding the elements by Class Name, CSS, Xpath but end up getting

selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable

When I inspect 2 times, the below table gets highlighted.

<table class="SearchBarInput" width="100%">
<tbody>
<tr><td width="">
<textarea style="width:99%;height:21px;" class="sr" cols="" wrap="off" rows="1" id="arid1005"></textarea></td>
</tr>
</tbody>
</table>

Can somebody throw some light on what I'm missing here? Sorry if this question was already asked but I couldn't find any relevant so far.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Santhosh Ram
  • 93
  • 11

1 Answers1

0

The id attribute of the desired element looks dynamic, so to click() on the element you have to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following solutions:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • If your element is not in the scope of the displayed page, as you said that element is in the bottom. Then first thing you should do is to scroll down the page so that element is in the scope of the displayed page. – nvntkmr Aug 14 '19 at 08:52
  • @nvntkmr Scrolling implicitly happens with EC as `element_to_be_clickable ()` – undetected Selenium Aug 14 '19 at 08:55
  • @DebanjanB, that didn't work for me, unfortunately. I'm getting **selenium.common.exceptions.TimeoutException: Message:** with no message. When I actually click on the Advanced search, it gives me the **SearchBarInput** in a different frame. But I actually can't find any frame element for that. Any idea? – Santhosh Ram Sep 03 '19 at 15:37
  • @DebanjanB, also when i try to copy the CSS selector or Xpath, it's not the same as what you've given. Am I missing something? :( – Santhosh Ram Sep 03 '19 at 15:40