So I have following element that I need to send keys to:
<input type="text" placeholder="Recipient address" class="text-gray-light py-1.5 sm:py-2 px-2 sm:px-3 bg-gray-dark border-0 block w-full rounded-md focus:ring-blue focus:border-blue" value="">
but there are many elements like this on the page. If I search:
//input[@placeholder="Recipient address"]
I get 35 results (exact same element as above) while finding that XPATH, although, only one is active. The rest are hidden in the DOM. When I try to send keys, I get Element not interactable exception which is normal since there are multiple elements, and driver most likely tries to send keys to the wrong one. Then I tried to create following function:
def try_transfer():
while True:
try:
element = WebDriverWait(driver.instance, 2).until(ec.element_to_be_clickable((By.XPATH, '//input['
'@placeholder="Recipient address"]')))
element.is_enabled()
element.click()
element.send_keys('HG4sYqvkTfgBvGgZZhYfws4f8BoytTr1NmcDEwkKC2z8')
except TimeoutException:
break
I don't get the error white above function, but, it does not send keys to the right element.
Any idea how would I go about finding that specific active element and sending keys to it.