我正在使用aCefSharp.Wpf.ChromiumWebBrowser(版本47.0.3.0)来加载网页.页面加载后的一些点我想得到源代码.
我打过电话:
wb.GetBrowser().MainFrame.GetSourceAsync()
Run Code Online (Sandbox Code Playgroud)
但它似乎没有返回所有的源代码(我相信这是因为有子帧).
如果我打电话:
wb.GetBrowser().MainFrame.ViewSource()
Run Code Online (Sandbox Code Playgroud)
我可以看到它列出了所有的源代码(包括内部框架).
我想得到与ViewSource()相同的结果.有人能指出我正确的方向吗?
更新 - 添加代码示例
注意:Web浏览器指向的地址也将仅适用于2016年10月10日.之后,它可能会显示不同的数据,这不是我要看的.
在frmSelection.xaml文件中
<cefSharp:ChromiumWebBrowser Name="wb" Grid.Column="1" Grid.Row="0" />
Run Code Online (Sandbox Code Playgroud)
在frmSelection.xaml.cs文件中
public partial class frmSelection : UserControl
{
private System.Windows.Threading.DispatcherTimer wbTimer = new System.Windows.Threading.DispatcherTimer();
public frmSelection()
{
InitializeComponent();
// This timer will start when a web page has been loaded.
// It will wait 4 seconds and then call wbTimer_Tick which
// will then see if data can be extracted from the web page.
wbTimer.Interval = new TimeSpan(0, 0, 4);
wbTimer.Tick += …Run Code Online (Sandbox Code Playgroud)