이 answer에 살펴보면 베드로의 의견을 고려은 :
it's working for me but it takes a while to get the url
나는 다음과 같은 코드를 썼습니다. 어쩌면 누군가에게 도움이 될 수있는이 코드가 작동 할 수 있도록
Process[] lFFs = Process.GetProcessesByName("firefox");
for (int i = 0; i < lEs.Length; i++)
{
UIAutomationClient.IUIAutomationElement ee = lEs.GetElement(i);
if (ee != null && ee.CurrentName != null &&
(ee.CurrentName.Contains("search") || ee.CurrentName.Contains("navigation")))
{ // For spanish you can use: (ee.CurrentName.Contains("de búsqueda") || ee.CurrentName== "Barra de navegación")
lEs = ee.FindAll(UIAutomationClient.TreeScope.TreeScope_Children, c);
if (lEs.Length > 0)
i = 0;
else
{
try
{
object obj = ee.GetCurrentPattern(10002); // 10002: ValuePattern
if (obj != null)
{
string sUrl = ((UIAutomationClient.IUIAutomationValuePattern)obj).CurrentValue;
return sUrl;
}
}
catch
{ }
}
}
}
중요, COM 라이브러리 참조해야합니다 코드 : UIAutomationClient
는
안녕하세요, 코드가 여전히 작동인가? 나는 시도했지만 성공하지 못했습니다. @PeterJ – Ayorus
그것은 나를 위해 일하고있다. 그러나 URL을 얻는 데는 시간이 걸린다. – PeterJ