I am trying to get url from chromed web browser, version 33 - using C #. I looked and tried different suggestions here on SO - but so far no luck.
Things I tried:
AutomationElement -> Getting the URL of the current tab from Google Chrome using C #
The "Addresses and Search Bar" element cannot be found using Automation in version 33 of the Chrome browser. I also tried using TreeWalker, and where only those elements were found:
Horizontal scroll bar
Back a little
Forward a small amount
Vertical scroll bar
Back a little
Forward a small amount
"Webpage Name ..."
System menu bar
System
Minimization
Recovery
Close
NDde â URL- Windows Forms
NDde.Client.DdeClient dde = new NDde.Client.DdeClient("Chrome", "WWW_GetWindowInfo");
dde.Connect();
NDde.Client.DdeClient dde = new NDde.Client.DdeClient("Chrome", "Chrome_OmniboxView");
dde.Connect();
... .
FindWindowEx â
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, string windowTitle);
public string GetChromeUrl(Process process)
{
IntPtr handle = IntPtr.Zero;
Process[] procsChrome = Process.GetProcessesByName("chrome");
foreach (Process chrome in procsChrome)
{
if (chrome.MainWindowHandle == IntPtr.Zero)
{
continue;
} else
{
handle = chrome.MainWindowHandle;
break;
}
}
IntPtr urlHandle = FindWindowEx(handle, IntPtr.Zero, null, "Address and search bar");
if (urlHandle != IntPtr.Zero)
{
Console.WriteLine("yes!");
}
return "";
}
...
, UI Spy , omnibox Chrome 33.
UI- , " ", url, ... , url?
?