简体   繁体   English

将C#WinForms应用程序中的文本插入Web浏览器文本框中

[英]Inserting text from a C# WinForms application into a web browser textbox

I'm currently working on a WinForms application that I'm hoping will allow users to enter stored passwords into a web browser without a keylogger being able to see the password. 我目前正在开发一个WinForms应用程序,希望该应用程序允许用户在Web浏览器中输入存储的密码,而键盘记录程序却无法看到该密码。 I've got the storing part completed, but I can't figure out how to insert the password into a browser without using either the clipboard or .NET's SendKeys class, both of which can be seen by most keyloggers. 我已经完成了存储部分,但是我不知道如何在不使用剪贴板或.NET的SendKeys类的情况下将密码插入浏览器,大多数键盘记录程序都可以看到这两种类型。

I looked into using Windows messages to do this, but, from what I understand, you need to know the hWnd of a control in order to send it a Windows message. 我研究了使用Windows消息执行此操作的方法,但是据我了解,您需要了解控件的硬件才能向其发送Windows消息。 Unfortunately, it appears that web browsers do not use hWnds for individual textbox controls. 不幸的是,Web浏览器似乎没有对单个文本框控件使用hWnds。

I know there has to be a way to do this. 我知道必须有一种方法可以做到这一点。 In Notepad++, for example, you can drag text into a web browser textbox and the text doesn't show up in keyloggers. 例如,在Notepad ++中,您可以将文本拖到Web浏览器文本框中,而文本不会显示在键盘记录器中。 Same goes for Neo's SafeKeys. Neo的SafeKeys也是如此。 Anyone have any ideas on a general approach to doing this? 有人对执行此操作的一般方法有任何想法吗? Thanks so much. 非常感谢。

What you want is a WebDriver Library. 您想要的是一个WebDriver库。 Unfortunately .net does not have plenty of good ones. 不幸的是,.net没有很多好的。 You can take a look at WatiN or selenium 您可以看一下WatiNselenium

From what I understand watin isn't supported anymore and is not multi-browser compatible. 据我了解,不再支持watin,并且不兼容多浏览器。

Here is an example of what you can do with selenium 这是您可以用硒做什么的一个例子

using (var driver = new ChromeDriver())
{
    driver.Navigate().GoToUrl("http://testing-ground.scraping.pro/login");
    var userNameField = driver.FindElementById("usr");
    var userPasswordField = driver.FindElementById("pwd");
    var loginButton = driver.FindElementByXPath("//input[@value='Login']");

    userNameField.SendKeys("admin");
    userPasswordField.SendKeys("12345");
    loginButton.Click();
}

I image you can link your driver to an existing opened browser 我可以将驱动程序链接到现有打开的浏览器,

If you are able to run ruby on the computers I would recommend using Watir and running the ruby script doing the web manipulation from the c# using processes. 如果您能够在计算机上运行ruby,我建议您使用Watir并通过使用进程从c#进行Web操作来运行ruby脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将文本从C#Web应用程序中的文本框复制到剪贴板 - How to copy text to clipboard from textbox in c# Web application C#Winforms:将文本从一个文本框移动到另一个文本框 - C# winforms: move text from one textbox to another 从C#WinForms应用程序禁用打开超链接的浏览器 - Disable hyperlink opening browser from c# winforms application 清除Web浏览器Cookie Winforms C# - Clear web browser cookies winforms C# C#Web服务从WinForms应用程序返回对象为null - C# Web Service returns objects as null from WinForms application Form2中的TextBox B使用C#和WinForms从Form 1中的TextBox A中显示文本 - TextBox B in Form2 to display text from TextBox A in Form 1 using C# and WinForms C#GeckoFX Web浏览器-从文本框中删除http - C# GeckoFX web browser - Remove http from textbox 如何在没有 IronPython 的情况下将 C#(winforms 应用程序)、当前文本框文本传递给 Python 变量 - How to pass C# (winforms application), current, textbox text to Python variable without IronPython 从C#中的另一个应用程序获取应用程序文本框的文本 - Get text of a textbox of an application from another application in C# 将字符串从 Winforms 应用程序背后的 C# 代码传递到网页文本框 - Pass string from C# Code Behind Winforms application to a webpage textbox
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM