Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 替换firefox当前页面中的字符串_.net_Vb.net_Winforms_Firefox - Fatal编程技术网

.net 替换firefox当前页面中的字符串

.net 替换firefox当前页面中的字符串,.net,vb.net,winforms,firefox,.net,Vb.net,Winforms,Firefox,我想将firefox当前页面html中的字符串(“123”替换为“111”) 说明: 我打开firefox,然后导航到: www.site.com/print.php?string=123 我在等文件完全装好 页面html: <html> <body> 123 </body> </html> 函数replaceInFFcurrentDocHtml()实际上不存在 firefox当前页面html中有一个函数可以替换字符串 或者从firefox获取

我想将firefox当前页面html中的字符串(“123”替换为“111”)

说明:

我打开firefox,然后导航到:

www.site.com/print.php?string=123
我在等文件完全装好

页面html:

<html>
<body>
123
</body>
</html>
函数
replaceInFFcurrentDocHtml()
实际上不存在

firefox当前页面html中有一个函数可以
替换
字符串

或者从firefox获取当前html的函数

(我试图通过spy++使用handle和windows获取html,但这种方式不起作用)

这本身并不完全是“入侵firefox”,但它可能会起作用

使用a并将站点的内容作为字符串下载,在该字符串上调用replace,并将结果写入临时html文件。最后,或者专门调用firefox来打开所述html文件,或者要求操作系统解析应该使用哪个应用程序来打开它

我相信Firefox(出于安全原因,任何浏览器都不应该)允许对DOM进行外部修改。这是唯一一种不需要对Firefox代码进行复杂修改的有效方法


还有一个很好的提示:不要使用GoTo,。

您可以编写Firefox扩展来修改页面内容,许多扩展都可以这样做


或者我相信Greasemonkey脚本也可以做同样的事情,

为什么不做一个浏览器扩展呢?
        openff("http://www.site.com/print.php?string=123") 'open url
again:
        For Each p As Process In Process.GetProcessesByName("firefox") 'wait until page is fully loaded
            If p.MainWindowTitle = "123 page title" Then
                Exit For
            Else
                Application.DoEvents()
                GoTo again
            End If
        Next
        replaceInFFcurrentDocHtml("123", "111") 'Replace the string!!!