Home>

There is a screen to enter the ID, password, and key as shown below.

<tr>
<td nowrap>ID:</td>
<td><input name = "@ PMCC-1 @" type = "text" value = "" size = "4" maxlength = "3" tabindex = "1"></td>
<td><span>number_digits_3</span></td>
</tr>
<tr>
<td nowrap>PASSWORD:</td>
<td><input name = "@ PMCC-2 @" type = "text" value = "" size = "7" maxlength = "6" tabindex = "2"></td>
<td><span>number_digits_6</span></td>
</tr>
<tr>
<td nowrap>KEY:</td>
<td><input name = "@ PMCC-3 @" type = "password" size = "12" maxlength = "10" tabindex = "3"></td>
<td><span>number_digits_4_10</span></td>
</tr>

On the contrary,

driver = webdriver.Chrome (r "\ chromedriver.exe")
driver.get ('https: // URL /')

Anumber = driver.find_element_by_name ('@ PMCC-1 @')
Anumber.send_keys ("111")
Bnumber = driver.find_element_by_name ('@ PMCC-2 @')
Bnumber.send_keys ("222222")
Cnumber = driver.find_element_by_name ('@ PMCC-3 @')
Cnumber.send_keys ("3333333")

Bottun_elm = driver.find_element_by_xpath (Login_Bottun_xpath)
Bottun_elm.click ()

I entered the text in input with send_key, but when I finished typing the first text and the second text was entered, the first text disappeared and the third was entered. And the second text disappears, and when you press the button, there is a strange phenomenon that only the third input contains characters.
What should I do?

It sounds like a mysterious phenomenon, but does anyone know anything about it and how to solve it?

  • Answer # 1

    First line
    driver = webdriver.Chrome (r "\ chromedriver.exe")

    I replaced this chrome driver with firefox and it worked fine. The text doesn't disappear even though it is the same program.
    So it's probably not a bug in this code, but a bug in Selenium's chromedriver.

  • Answer # 2

    I pasted the above HTML into my local environment and tried it, but the text remains.
    There may be some other factor.

    For example

    Anumber = driver.find_element_by_name ('@ PMCC-1 @')
    Anumber.click ()
    Anumber.send_keys ("111")
    Bnumber = driver.find_element_by_name ('@ PMCC-2 @')
    Bnumber.click ()
    Bnumber.send_keys ("222222")
    Cnumber = driver.find_element_by_name ('@ PMCC-3 @')
    Cnumber.click ()
    Cnumber.send_keys ("3333333")


    Or try
    Selenium Webdriver --The entered text is vanished when jumping to the next field

    In the example of this article,

    from selenium.webdriver.common.keys import Keys
    element.send_keys (text)
    element.send_keys (Keys.UP)


    And so on.