Send keys not working selenium webdriver python

As you mentioned send_keys(“TEST”) are not working, there are a couple of alternatives to send a character sequence to respective fields as mentioned below : Use Keys.NUMPAD3 [simulating send_keys(“3”)]: login.send_keys(Keys.NUMPAD3) Use JavascriptExecutor with getElementById : self.driver.execute_script(“document.getElementById(‘login_email’).value=”12345″”) Use JavascriptExecutor with getElementsById : self.driver.execute_script(“document.getElementsById(‘login_password’)[0].value=”password””) Now comming to your specific issue, as you mentioned I tried to use … Read more

Change keyboard layout from C# code with .NET 4.5.2

Switching the keyboard layout requires some P/Invoke; you´ll need at least the following Windows functions to get it working: LoadKeyboardLayout, GetKeyboardLayout and ActivateKeyboardLayout. The following import declarations worked for me… [DllImport(“user32.dll”, CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, EntryPoint = “LoadKeyboardLayout”, SetLastError = true, ThrowOnUnmappableChar = false)] static extern uint LoadKeyboardLayout( StringBuilder pwszKLID, uint flags); [DllImport(“user32.dll”, … Read more

Sending Windows key using SendKeys

OK turns out what you really want is this: http://inputsimulator.codeplex.com/ Which has done all the hard work of exposing the Win32 SendInput methods to C#. This allows you to directly send the windows key. This is tested and works: InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.LWIN, VirtualKeyCode.VK_E); Note however that in some cases you want to specifically send the key to … Read more

How to send a key to another application

If notepad is already started, you should write: // import the function in your class [DllImport (“User32.dll”)] static extern int SetForegroundWindow(IntPtr point); //… Process p = Process.GetProcessesByName(“notepad”).FirstOrDefault(); if (p != null) { IntPtr h = p.MainWindowHandle; SetForegroundWindow(h); SendKeys.SendWait(“k”); } GetProcessesByName returns an array of processes, so you should get the first one (or find the … Read more

How do I send key strokes to a window without having to activate it using Windows API?

Alright, this is kind of disappointing I’m sure, but you fundamentally cannot do this with 100% reliability. Windows assumes that the active window is the one getting keyboard input. The proper way to fake keyboard input is with SendInput, and you’ll notice that it sends messages to the active window only. That being said, you … Read more