繁体   English   中英

如何在C#中使用WebBrowser控件单击页面1的按钮后获取导航的页面2的URL

[英]How to get url of navigated page 2 after button click of page 1 using WebBrowser Control in C#

我已成功使用webbrowser控件从www.url 1 .com导航到www.url 2 .com,但我无法在asp.net Web应用程序中使用Webbrowser控件获取导航页面的网址,即www.url 2 .com。 。

 Example:
I navigated to www.google.com

webBrowser.Navigate("http://www.google.com");

in that page i programatically given some text and click google search button as follow

HtmlElement textElement = webBrowser.Document.All.GetElementsByName("q")[0];
textElement.SetAttribute("value", "your text to search");
HtmlElement btnElement = webBrowser.Document.All.GetElementsByName("btnG")[0];
btnElement.InvokeMember("click");

导航到[ https://www.google.co.in/?gfe_rd=cr&ei=dFMuWdWCHory8Afuwqog#q=your+text+to+search “]之后

Here my Question is How to get the that particular navigated url USING WEBBROWSER CONTROL IN c# i.e.,
**https://www.google.co.in/?gfe_rd=cr&ei=dFMuWdWCHory8Afuwqog#q=your+text+to+search"**

如果您对此问题有任何解决方案,请与我分享。

提前致谢。

由于页面是Web应用程序,因此使用href链接页面

<a href="https://www.google.com">Google </a>

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM