Web 浏览器控件单击
我在项目中使用 Web 浏览器控件,并打开一个具有文件选择器对象的 Web。 现在我想以编程方式注入此文件选择器对象中的文件路径。
我试图获取 HtmlElement
,但我在源代码中找不到元素 Id。
编辑:
在网络中,有一个“浏览...”按钮,可以打开文件选择器,然后文件路径显示在小文本字段中,我想将自己的文件路径注入到文本字段中。
I am using Web Browser control in my project and i open a web that have file chooser object.
Now i want to inject programmatically a path to a file in this file chooser object .
I tried to get the HtmlElement
,but i not found in the source code the element Id.
Edit:
In the web there is "Browse..." button that open a file chooser,and then the file path is show in little text filed, and i want to inject the file path my self to the text field.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
第一的。
为要更改其值的元素建立名称、id 或类。有多种方法可以做到这一点。我会使用 firefox 的 firebug 或 IE 开发人员工具栏,或者只是查看页面的源代码并确定字段的名称/ID。现在,如果该字段没有可以使用的名称或 ID,您也许能够获取包含元素并迭代子元素 n 次,直到获得所需的元素。
对于我的嵌入式浏览器应用程序,我在 c# 中执行了以下操作:-
那么您有相关页面的 HTML 吗?这可能会有所帮助,并且可以给出更好的答案
问候朱利安
First.
establish a name, id or class for the element you want to change the value of. There are a number of ways of doing this. I would use firebug for firefox, or IE developer toolbar, or just view the source of the page and establish what the name/Id of the field is. Now if that field does not have a Name or an ID that you can use you might be able to get the containing element and iterate through the Child elements n times until you get the element you want.
For my embedded browser app I did the following in c#:-
So do you have the HTML of the page in question? that might help and a better answer can be given
Regards Julian