skip to Main Content

Why is the send_keys function ignoring spaces in my python script? I used vnc on ubuntu/debian 10. Everything works correctly when I run the script on my computer, but all spaces disappear on vps with vnc. Error is in Google chrome.
`

element.send_keys("1 2 3")

result: "123"

`

Replacing the spaces with "Keys.SPACE" did not help me.

I tried adding two slashes element.send_keys("John\ Doe")

2

Answers


  1. Chosen as BEST ANSWER

    I haven't been able to get this to work in Chrome. But spaces work fine in Firefox, so I'll have to use that. If someone finds the cause or solution to my problem, please write


  2. Try importing the libs and instantiate actions:

    # Needed libs
    from selenium import webdriver
    from selenium.webdriver.common.action_chains import ActionChains
    import time
    
    # We create the driver
    driver = webdriver.Chrome()
    action = ActionChains(driver)
    

    Then make click into your element with something like:

    element.click()
    

    Then send the keys like:

    action.send_keys(departure).perform()
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search