private static extern int wdGetCookies(SafeHandle handle, ref StringWrapperHandle cookies);
 private static extern int wdGetTitle(SafeHandle handle, ref StringWrapperHandle result);
            //TODO(andre.nogueira): check result
            public Dictionary<String, Cookie> GetCookies()
            {
                String currentUrl = GetCurrentHost();

                StringWrapperHandle wrapper = new StringWrapperHandle();
                int result = wdGetCookies(handle, ref wrapper);

                //handleErrorCode("Unable to extract visible cookies", result);

                Dictionary<String, Cookie> toReturn = new Dictionary<String, Cookie>();
                String allDomainCookies = wrapper.Value;

                String[] cookies =
                    allDomainCookies.Split(new String[] { "; " },
                                           StringSplitOptions.RemoveEmptyEntries);
                foreach (String cookie in cookies)
                {
                    String[] parts = cookie.Split(new String[] { "=" }, StringSplitOptions.RemoveEmptyEntries);
                    if (parts.Length != 2)
                    {
                        continue;
                    }

                    toReturn.Add(parts[0], new Cookie(parts[0], parts[1], currentUrl, ""));
                }

                return toReturn;
            }
 private static extern int wdGetPageSource(SafeInternetExplorerDriverHandle driver, ref StringWrapperHandle wrapper);
 private static extern int wdGetCurrentUrl(SafeHandle handle, ref StringWrapperHandle result);
 private static extern int wdeGetText(ElementWrapper wrapper, ref StringWrapperHandle result);
 private static extern int wdeGetAttribute(ElementWrapper wrapper, [MarshalAs(UnmanagedType.LPWStr)] string attributeName, ref StringWrapperHandle result);
 public string GetAttribute(string attributeName)
 {
     StringWrapperHandle result = new StringWrapperHandle();
     wdeGetAttribute(wrapper, attributeName, ref result);
     return result.Value;
 }