'Selenium send_keys doesn't send uppercase R within the input bar

I'm using selenium 4.1.0 and I'm trying to send 'CRISTIAN' in an input bar through

input_bar.send_keys('CRISTIAN')

But it shows 'CISTIAN' in the bar. I've tried also tried:

ActionChains(driver).click(input_bar).send_keys('CRISTIAN', Keys.ENTER).perform()` 

But I get the same result. I checked all the uppercase letters and I figured out that only R have this problem. Any suggestions? Does it depends on this version of Selenium?

HTML of the input bar:

<div _ngcontent-qhp-c128="" cdkdroplist="" cdkdroplistorientation="horizontal" cdkdroplistdisabled="" class="cdk-drop-list d-flex flex-1 cdk-drop-list-disabled" id="cdk-drop-list-16"><input _ngcontent-qhp-c128="" cdkdrag="" data-bp="input" class="cdk-drag comp-input mt-2 cdk-drag-disabled" placeholder="Aggiungi elemento"><!----><!----><!----><!----></div>


Solution 1:[1]

The desired element is a Angular element, to send a character sequence you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following locator strategies:

  • Using CSS_SELECTOR:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div[id^='cdk-drop-list'][cdkdroplistorientation='horizontal'] input[class*='cdk-drag'][data-bp='input'][placeholder='Aggiungi elemento']"))).send_keys('CRISTIAN')
    
  • Using XPATH:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@cdkdroplistorientation='horizontal' and starts-with(@id, 'cdk-drop-list')]//input[contains(@class, 'cdk-drag') and @data-bp='input'][@placeholder='Aggiungi elemento']"))).send_keys('CRISTIAN')
    
  • Note: You have to add the following imports :

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 undetected Selenium