Selenium didn't fill out the form correctly

Question:

1. First Case

This is my script, I wanna log in to google using selenium.

## ...
driver.get("https://www.smile.one/customer/account/login")
time.sleep(10)
driver.find_element_by_name('identifier').send_keys(email + Keys.RETURN)
time.sleep(5)
driver.find_element_by_name('password').send_keys(mantra + Keys.RETURN)
## ...

The script above work properly when I tried on my laptop. The identifier field filled with "exampleemail24" and the password filled with "example24".

However, the script above doesn’t work when I use it on VPS (AWS EC2 t3.small 2vCPU 2GB RAM). The identifier fields filled correctly by "exampleemail24" but the password filled by "example".

2. Second Case

I tried in another form but I got the same problem.
This is my script.

time.sleep(3) userid_form = driver.find_element_by_id('museid')
serverid_form = driver.find_element_by_id('mserverid')
userid_form.send_keys(data['user_id'])
serverid_form.send_keys(data['server_id'] + Keys.SHIFT, Keys.TAB)

This is the form.

<form id="mpay" action="/merchant/pay" method="post">
    <div class="sectionId-bor">
       <input type="tel" class="sectionId-input" id="museid" placeholder="USER ID" value="">
       <input type="tel" class="sectionId-input" id="mserverid" placeholder="Server ID" value="">
    </div>
</form>

There are two fields: userid and serverid. When I tried the script in localhost (my laptop), the script works properly. Filled userid with "79100601" and serverid with "2149". However,791 when I deployed it on VPS (same VPS with the first case VPS). The userid filled with "791006" and serverid "012149".

Additional

I have ensured by print the variables that I used and they are correct.

Both cases show no error logs. And also tried to use selenium wait until and python sleep for 10 seconds. So, I think not caused by slow internet connection or elements not fully loaded.

Where is the problem? Have you ever experienced this?

Asked By: xdnroot

||

Answers:

Based on my testing, it turns out that this problem is caused by VNC that I am using. I don’t know the exact problem. However, the error I mentioned above didn’t occur and my script was running normally after I install this package:

sudo apt install tigervnc-xorg-extension tigervnc-viewer
Answered By: xdnroot