如何使用Visual Basic在Geckofx中使用内部文本 [英] How to use innertext in geckofx using visual basic

查看:153
本文介绍了如何使用Visual Basic在Geckofx中使用内部文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,新手在这里.

因此,我想制作一个程序,该程序将使用GeckoWebBrowser打开一个网站.该网站上有一个文本框,我想在该文本框中插入一个文本.

例如,在经典的Web浏览器上,我将执行以下操作:
WebBrowser1.Document.GetElementById("word").InnerText ="gehen"

现在,我想在GeckoWebBrowser中做同样的事情,但是问题是它似乎没有innerText控件.

这是html代码的一部分:

Hello, newbie here.

So, I want to make a program, which will open up a website with GeckoWebBrowser. There in that website is a text box, and I want to insert a text into that text box.

For instance, on a classic web browser I would do this:
WebBrowser1.Document.GetElementById("word").InnerText = "gehen"

Now, I would like to do the same thing in GeckoWebBrowser, but the problem is that it doesn''t seem to have the innerText control.

Here is the part of the html code:

<pre><pre><input id="word" class="input_style ui-autocomplete-input" type="text" maxlength="50">



并链接到该网站以获得更好的视图:
https://www.dict.com/德语-英语

我尝试过的事情:

这是我尝试过的...

第一次尝试:



And the link to the website for the better view:
https://www.dict.com/German-English

What I have tried:

Here''s what I''ve tried...

1st try:

GeckoWebBrowser1.Document.GetElementById("word").TextContent = "gehen"


第2次尝试:


2nd try:

GeckoWebBrowser1.Document.GetElementById("word").SetAttribute("text", "gehen")


第三次尝试:
我从某个论坛上获得的信息:


3rd try:
What I got from some forum:

Dim myElement As Gecko.GeckoHtmlElement = Nothing
Dim myDoc As Gecko.GeckoDocument = GeckoWebBrowser1.Window.Document
myElement = myDoc.GetHtmlElementById("word")

If myElement IsNot Nothing Then
    myElement.InnerHtml = "gehen"
End If



就是这样.我已经尝试了整整一个星期,但是似乎找不到我的问题的答案.我在不同的论坛上搜索过,我也可能搜索了整个网络,但没有运气.

我真的希望您能提供帮助,并非常感谢您.
祝您一天余下的时间像巧克力一样令人惊奇:)



And that''s about it. I''ve been trying this for a whole week, but I just don''t seem to find an answer to my question. I''ve searched on different forums, I might as well have searched the whole web, but no luck.

I really hope you can help, and thank you very, very much for it.
May the rest of your day be as amazing as the taste of a chocolate :)

推荐答案

成员,您好13254081.

我用过这样的东西.

Hi, Member 13254081.

I used something like this.

Dim inputter As GeckoTextAreaElement = DirectCast(GeckoWeb.Document.GetElementById("wpTextbox1"), GeckoTextAreaElement)



那这个...



then this...

inputter.ScrollIntoView(True)
                inputter.Focus()
                inputter.SelectionDirection = "forward"
                inputter.SelectionStart = inputter.Value.IndexOf("<!-- ProtoItem-Name:", StringComparison.Ordinal)
                inputter.SelectionEnd = inputter.Value.IndexOf("}}", StringComparison.Ordinal)
                inputter.Select()
                inputter.Focus()
                inputter.Value = etwasvordemquelltext & tempgegenstand.SeitenQuellText & vbNewLine & etwasnachdemquelltext



它用于改变它认为...的组合框上的选择....

但最重要的是



this is used to cahnge the selection on a Combobox it think....

But the most Importent is the "inputter.Value" of the

GeckoTextAreaElement 


的"inputter.Value"
c.u.来自汉堡的Zui



c.u. Zui from Hamburg


这篇关于如何使用Visual Basic在Geckofx中使用内部文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆