How to get a browser details using the WebDocument class in Ranorex
File: GetBrowserDetails.UserCode.cs
usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Text.RegularExpressions;usingSystem.Drawing;usingSystem.Threading;usingWinForms=System.Windows.Forms;usingRanorex;usingRanorex.Core;usingRanorex.Core.Repository;usingRanorex.Core.Testing;namespaceGlobalProjects{publicpartialclassGetBrowserDetails{privatevoidInit(){Browser("Chrome","https://kodingwindow.com/testapp/");}publicvoidBrowser(stringbname,stringurl){try{Report.Info("Opening the "+bname+" browser");Host.Current.OpenBrowser(url,bname,"",false,true,false,false,false);//true will maximize the browser windowDelay.Seconds(5);WebDocumentwd="/dom[@domain='kodingwindow.com']";Report.Info("Browser Name - "+wd.BrowserName);Report.Info("Browser Version - "+wd.BrowserVersion);Report.Info("Domain - "+wd.Domain);Report.Info("Page Title - "+wd.Browser);Report.Info("Page URL - "+wd.PageUrl);Report.Info("Flavor Name - "+wd.FlavorName);Report.Info("Browser State - "+wd.State);Report.Info("Browser Valid - "+wd.Valid);//Host.Current.CloseApplication(wd,new Duration(0));wd.Close();if(wd.Valid.Equals(false)){Report.Success("Browser closed successfully");}else{Report.Failure("Fail: Unable to close the browser window");}}catch{Report.Failure("Error: Unable to open the browser");}}}}
Dear User, Thank you for visitng Kodingwindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.
Dear User, We are grateful for your interest in the Kodingwindow Android app. We intend to soon make it available on the Google Play Store. Currently, Android versions 10 and up require manual apk installations. Would you like to get the app?