question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SendKeys fails to push repeated characters

See original GitHub issue

expected : …gNPPumwQw… actual sent: …gNPumwQw…

we noticed on azure microsoft hosted agents, win app driver sendkeys sometimes skips the repeated character in string. (e.g. see portion of string above when PP is sent then it just takes 1 P instead of both) Locally it works fine so it is something specific to environment where it runs. any workaround to this ? anything env specific stuff we should set on the pipeline agent may be a powershell script ? Version of winappdriver is 1.2.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
sachinerandecapitacommented, Feb 2, 2022

I was able to put the content on clipboard using powershell. (not using powershell sdk). And it works fine and consistent success both on pipeline and local machine.

Didn’t use System.Windows.Forms because to use it project must be set to use windows .net 5 <TargetFramework>net5.0-windows</TargetFramework>, which wasn’t suitable for us to keep things platform independent.

1reaction
anunay1commented, Jan 31, 2022

You can use the custom method which can be used like set Immediate text

public void SetText(WindowsElement editField, string text)
        {
            Thread STAThread = new Thread(
                delegate ()
                {
                    System.Windows.Forms.Clipboard.SetText(text);
                    editField.Click();
                    driver.Keyboard.SendKeys(OpenQA.Selenium.Keys.Control + "v" + OpenQA.Selenium.Keys.Control);
                });
            STAThread.SetApartmentState(ApartmentState.STA);
            STAThread.Start();
            STAThread.Join();
        }
Read more comments on GitHub >

github_iconTop Results From Across the Web

selenium - SendKeys() method ignores some characters ...
Therefore the tests failed. I'm trying to do the following : _passWordTextBox.Clear(); _passWordTextBox.SendKeys("!!ä{dasd$352310!!!
Read more >
Duplicate characters appears using SendKeys.SendWait ...
Hi, I am using SendKeys.SendWait("ABC") function to pass keypress event on webbrowser textbox. But it appears as "AABBCC".
Read more >
Selenium SendKeys: A Detailed Usage Guide With Examples
SendKeys is a method used to send keyboard input such as characters, numbers, and symbols to text boxes inside an application.
Read more >
Selenium SendKeys: A Detailed Usage Guide
Selenium Sendkeys is a method used in Selenium WebDriver to simulate the typing of a keyboard key in a web application.
Read more >
SendKeys statement (VBA)
To specify repeating keys, use the form {key number} . You must put a space between key and number . For example, {LEFT...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found