sendkeys

Python Selenium - AttributeError : WebElement object has no attribute sendKeys

本秂侑毒 提交于 2019-11-29 06:47:08
I'm trying to pass through "ENTER" to a text field, using Selenium (Python). The text box requires that each phone number be entered on a new line, so it will look something like: #Add the phone number# Webelement.sendKeys(Keys.ENTER) I've imported the following library: from selenium.webdriver.common.keys import Keys The problem I'm getting is that it fails with: AttributeError: 'WebElement' object has no attribute 'sendKeys' Does anyone know how to resolve this? I've been searching for a solution, but haven't been able to find anything. Try using WebElement::send_keys() instead of sendKeys

Trigger OS to copy (ctrl+c or Ctrl-x) programmatically

巧了我就是萌 提交于 2019-11-29 05:09:13
I'm working on a program to trigger cut and pastes Pastes I have no problem with (I just dump a string into the clipboard) Cut and or Copys are proving to be a little more difficult The program I have is out of focus and has several hot keys registered with the os CTRL + ALT + 2 CTRL + ALT + 3 etc) That I want to use to trigger Windows to copy anything that is highlighted in the window that is focused I tried doing a sendkeys SendKeys.Send("^c"); but that seems to work once or twice if at all then stop working. is there a better way to try to trigger windows into coping highlighted content on

C# // SendKeys.SendWait works only when process'es window is minimzed

杀马特。学长 韩版系。学妹 提交于 2019-11-29 05:07:16
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; using System.ComponentModel; using System.Data; using System.Runtime.InteropServices; using System.Diagnostics; using System.Threading; using System.Windows.Forms; using System.Drawing; namespace TextSendKeys { class Program { [DllImport("user32.dll")] static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); static void Main(string[] args) { Process[] processes = Process.GetProcessesByName("game"); Process game1 = processes[0]; IntPtr p = game1.MainWindowHandle; ShowWindow(p,1);

Background Key Press Listener

萝らか妹 提交于 2019-11-29 02:38:26
I've got a simple window form application that turns on capslock when I press space and turns it off if I press a letter. Problem is that I have to focus on the window for it to work (top-most doesn't work either, top-most doesn't focus it just displaying the window above all other unfocused). Anyone has any idea how can I make it work even if im writing in a notepad? Key logging can be used for naughty stuff, and manipulating Caps Lock like that seems rather strange, but since the info is already publicly available, and you know your user stories better than me, I've posted a solution. Here's

How can I send keyboard commands (hold,release,simultanous) with a python script?

寵の児 提交于 2019-11-28 22:08:08
I want to send virtually the command like this: when keypress=="a" #if entered key is "a" send {ALT+TAB} # send ALT and TAB simultaneously sleep(2) #wait for 2 sec send {"I love my Country",0.1} #send all strings at 0.1 sec wait key_down("BACKSPACE",1) #hold down backspace key for 1 sec send{ALT+F4} #send ALT and F4 simultaneously For all, or a particular application, also opengl games as well. I tried SendKeys.py but there is no simultaneously input function and no key_down method for sending holding down a key command. All advice will be greatly appreciated. I know how to do it with ctypes.

Simple Application for sending Keystroke in VB.NET

依然范特西╮ 提交于 2019-11-28 14:45:37
I have an issue regarding Sendkeys Class, as i want to use this class in order to send some keystroke to the active application. As a first step i want to test the {Enter} keystroke, so in order to achieve that i made a simple application in vb.net 2010 Public Class Form1 Public Shared data As String Private Sub SendintText(command As String) Try SendKeys.SendWait(command) Catch e As Exception MsgBox(e.StackTrace) End Try End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click data = TextBox1.Text.ToString SendingText(data) End Sub End Class When

.NET sendkeys to calculator

本小妞迷上赌 提交于 2019-11-28 11:41:30
The sendkeys code below works well for Notepad but it doesn't work for Calculator. What is the problem? (It's another problem compared to what I sent here Sendkeys problem from .NET program ) [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern IntPtr FindWindow(string lpClassName,string lpWindowName); [DllImport("User32")] public static extern bool SetForegroundWindow(IntPtr hWnd); private void button1_Click(object sender, EventArgs e) { IntPtr calculatorHandle = FindWindow("SciCalc", "Calculator"); //IntPtr calculatorHandle = FindWindow("Notepad", "Untitled - Notepad");

How to preserve the character sequence sent through SendKeys() method through Selenium and C#

夙愿已清 提交于 2019-11-28 11:39:18
问题 Selenium c# when entering data in a Textbox for My Test Website the the cursor position is set to the Middle and the data entered is like for e.g. 3421 instead of the correct Order of 1234 . Can anyone suggest a good way as to how to handle this? I have tried to Use pressing the HOME key button but it did not work. 回答1: It would be tough to predict the actual issue behind the non perseverance of the sequential order of the character sequence sent through SendKeys() method in absence of the

Detecting Ctrl+V with RegisterHotKey but not intercepting it

牧云@^-^@ 提交于 2019-11-28 09:18:20
I need to detect when a user presses Ctrl + V (regardless of window focus - my app will likely be minimised) but I must not stop the actual paste operation. I have tried a few things: (I am successfully binding to keystrokes with RegisterHotKey) I have: protected override void WndProc(ref Message m) { if (m.Msg == 0x312) hotKey(); base.WndProc(ref m); } and I've tried the following: void hotKey() { SendKeys.SendWait("^v"); //just puts 'v' instead of clipboard contents } and void hotKey() { SendKeys.SendWait(ClipBoard.GetText()); /* This works, but since Ctrl is still down, it triggers * all

Why do some applications not accept some sendkeys at some times

梦想与她 提交于 2019-11-28 06:54:01
问题 This is an issue I've ran into before, but I've always given up solving the problem and worked out a work around. Not today (hopefully). I'm trying to make a bot for the classic Doom II. I want my bot to have access to the main menu which is accessed via the escape key. Naturally I tried: sendkeys.send("{ESC}") No luck. But then something weird happened. I accidently ran the code when I was already on the menu... and it closed the menu (which is normal if you press escape on the menu). So