當前位置: 首頁>>代碼示例>>C#>>正文


C# IE.SafeInternetExplorerWebElementHandle類代碼示例

本文整理匯總了C#中OpenQA.Selenium.IE.SafeInternetExplorerWebElementHandle的典型用法代碼示例。如果您正苦於以下問題:C# SafeInternetExplorerWebElementHandle類的具體用法?C# SafeInternetExplorerWebElementHandle怎麽用?C# SafeInternetExplorerWebElementHandle使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SafeInternetExplorerWebElementHandle類屬於OpenQA.Selenium.IE命名空間,在下文中一共展示了SafeInternetExplorerWebElementHandle類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: FindElementByClassName

 /// <summary>
 /// Method to return the first element that matches the CSS class passed in
 /// </summary>
 /// <param name="className">CSS class name</param>
 /// <returns>IWebElement object so that you can interact that object</returns>
 public IWebElement FindElementByClassName(string className)
 {
     SafeInternetExplorerWebElementHandle rawElement = new SafeInternetExplorerWebElementHandle();
     WebDriverResult result = NativeMethods.wdFindElementByClassName(handle, parent, className, ref rawElement);
     ResultHandler.VerifyResultCode(result, "FindElementByClassName");
     return new InternetExplorerWebElement(driver, rawElement);
 }
開發者ID:epall,項目名稱:selenium,代碼行數:12,代碼來源:Finder.cs

示例2: ToList

        /// <summary>
        /// Converts a Collection of elements into a list
        /// </summary>
        /// <returns>List of IWebElement</returns>
        public List<IWebElement> ToList()
        {
            List<IWebElement> toReturn = new List<IWebElement>();
            int numberOfElements = 0;
            NativeDriverLibrary.Instance.GetElementCollectionLength(collectionHandle, ref numberOfElements);
            for (int i = 0; i < numberOfElements; i++)
            {
                SafeInternetExplorerWebElementHandle wrapper = new SafeInternetExplorerWebElementHandle();
                WebDriverResult result = NativeDriverLibrary.Instance.GetElementAtIndex(collectionHandle, i, ref wrapper);

                // OPTIMIZATION: Check for a success value, then run through the
                // VerifyErrorCode which will throw the proper exception
                if (result != WebDriverResult.Success)
                {
                    try
                    {
                        ResultHandler.VerifyResultCode(result, string.Empty);
                    }
                    catch (Exception e)
                    {
                        // We need to process the exception to free the memory.
                        // Then we can wrap and rethrow.
                        collectionHandle.FreeElementsOnDispose = true;
                        Dispose();
                        throw new WebDriverException("Could not retrieve element " + i + " from element collection", e);
                    }
                }

                toReturn.Add(new InternetExplorerWebElement(driver, wrapper));
            }
            ////TODO(andre.nogueira): from the java code (elementcollection.java)... "Free memory from the collection"
            return toReturn;
        }
開發者ID:hugs,項目名稱:selenium,代碼行數:37,代碼來源:InternetExplorerWebElementCollection.cs

示例3: FindElementById

 /// <summary>
 /// Find the first element that has this ID
 /// </summary>
 /// <param name="id">ID of web element on the page</param>
 /// <returns>Returns a IWebElement to use</returns>
 public IWebElement FindElementById(string id)
 {
     SafeInternetExplorerWebElementHandle rawElement = new SafeInternetExplorerWebElementHandle();
     WebDriverResult result = NativeDriverLibrary.Instance.FindElementById(handle, parent, id, ref rawElement);
     ResultHandler.VerifyResultCode(result, "FindElementById");
     return new InternetExplorerWebElement(driver, rawElement);
 }
開發者ID:zerodiv,項目名稱:CTM-Windows-Agent,代碼行數:12,代碼來源:Finder.cs

示例4: Finder

        /// <summary>
        /// Initializes a new instance of the Finder class.
        /// </summary>
        /// <param name="driver">InternetExplorerDriver in use</param>
        /// <param name="parent">ElementHandle to for use with the Native methods</param>
        public Finder(InternetExplorerDriver driver, SafeInternetExplorerWebElementHandle parent)
        {
            this.driver = driver;
            if (parent != null)
            {
                this.parent = parent;
            }
            else
            {
                this.parent = new SafeInternetExplorerWebElementHandle();
            }

            handle = driver.GetUnderlayingHandle();
        }
開發者ID:epall,項目名稱:selenium,代碼行數:19,代碼來源:Finder.cs

示例5: wdeGetSize

 internal static extern WebDriverResult wdeGetSize(SafeInternetExplorerWebElementHandle element, ref int width, ref int height);
開發者ID:epall,項目名稱:selenium,代碼行數:1,代碼來源:NativeMethods.cs

示例6: GetElementValueOfCssProperty

 /// <summary>
 /// Gets a value of a CSS property for the element.
 /// </summary>
 /// <param name="elementHandle">A handle to the instance of the <see cref="InternetExplorerWebElement"/> class.</param>
 /// <param name="propertyName">The name of the property.</param>
 /// <param name="propertyValueWrapperHandle">A pointer to a string containing the property value.</param>
 /// <returns>A <see cref="WebDriverResult"/> value indicating success or failure.</returns>
 internal WebDriverResult GetElementValueOfCssProperty(SafeInternetExplorerWebElementHandle elementHandle, string propertyName, ref SafeStringWrapperHandle propertyValueWrapperHandle)
 {
     IntPtr functionPointer = NativeMethods.GetProcAddress(nativeLibraryHandle, GetValueOfCssPropertyFunctionName);
     CssPropertyValueElementFunction getCssPropertyValueFunction = Marshal.GetDelegateForFunctionPointer(functionPointer, typeof(CssPropertyValueElementFunction)) as CssPropertyValueElementFunction;
     WebDriverResult result = getCssPropertyValueFunction(elementHandle, propertyName, ref propertyValueWrapperHandle);
     return result;
 }
開發者ID:hugs,項目名稱:selenium,代碼行數:14,代碼來源:NativeDriverLibrary.cs

示例7: wdeGetLocation

 internal static extern WebDriverResult wdeGetLocation(SafeInternetExplorerWebElementHandle element, ref int x, ref int y);
開發者ID:epall,項目名稱:selenium,代碼行數:1,代碼來源:NativeMethods.cs

示例8: GetElementScriptResult

 /// <summary>
 /// Retrieves the value from the script result.
 /// </summary>
 /// <param name="scriptResultHandle">A handle to the result of the script.</param>
 /// <param name="driverHandle">A handle to the instance of the <see cref="InternetExplorerDriver"/> class.</param>
 /// <param name="scriptResultValue">A value representing the value of the returned object from the script.</param>
 /// <returns>A <see cref="WebDriverResult"/> value indicating success or failure.</returns>
 internal WebDriverResult GetElementScriptResult(SafeScriptResultHandle scriptResultHandle, SafeInternetExplorerDriverHandle driverHandle, out SafeInternetExplorerWebElementHandle scriptResultValue)
 {
     IntPtr functionPointer = NativeMethods.GetProcAddress(nativeLibraryHandle, GetElementScriptResultFunctionName);
     ElementReturningScriptResultFunction scriptResultFunction = Marshal.GetDelegateForFunctionPointer(functionPointer, typeof(ElementReturningScriptResultFunction)) as ElementReturningScriptResultFunction;
     WebDriverResult result = scriptResultFunction(scriptResultHandle, driverHandle, out scriptResultValue);
     return result;
 }
開發者ID:hugs,項目名稱:selenium,代碼行數:14,代碼來源:NativeDriverLibrary.cs

示例9: Finder

 /// <summary>
 /// Initializes a new instance of the Finder class.
 /// </summary>
 /// <param name="driver">InternetExplorerDriver in use</param>
 /// <param name="parent">ElementHandle to for use with the Native methods</param>
 public Finder(InternetExplorerDriver driver, SafeInternetExplorerWebElementHandle parent)
 {
     this.driver = driver;
     this.parent = parent;
     handle = driver.GetUnderlayingHandle();
 }
開發者ID:zerodiv,項目名稱:CTM-Windows-Agent,代碼行數:11,代碼來源:Finder.cs

示例10: wdeIsDisplayed

 internal static extern WebDriverResult wdeIsDisplayed(SafeInternetExplorerWebElementHandle handle, ref int displayed);
開發者ID:epall,項目名稱:selenium,代碼行數:1,代碼來源:NativeMethods.cs

示例11: wdeSendKeys

 internal static extern WebDriverResult wdeSendKeys(SafeInternetExplorerWebElementHandle wrapper, [MarshalAs(UnmanagedType.LPWStr)] string text);
開發者ID:epall,項目名稱:selenium,代碼行數:1,代碼來源:NativeMethods.cs

示例12: wdGetElementScriptResult

 internal static extern WebDriverResult wdGetElementScriptResult(SafeScriptResultHandle scriptResult, SafeInternetExplorerDriverHandle driver, out SafeInternetExplorerWebElementHandle value);
開發者ID:epall,項目名稱:selenium,代碼行數:1,代碼來源:NativeMethods.cs

示例13: wdSwitchToActiveElement

 internal static extern WebDriverResult wdSwitchToActiveElement(SafeInternetExplorerDriverHandle driver, ref SafeInternetExplorerWebElementHandle result);
開發者ID:epall,項目名稱:selenium,代碼行數:1,代碼來源:NativeMethods.cs

示例14: wdFindElementsByXPath

 internal static extern WebDriverResult wdFindElementsByXPath(SafeInternetExplorerDriverHandle driver, SafeInternetExplorerWebElementHandle element, [MarshalAs(UnmanagedType.LPWStr)] string xpath, ref SafeWebElementCollectionHandle result);
開發者ID:epall,項目名稱:selenium,代碼行數:1,代碼來源:NativeMethods.cs

示例15: wdAddElementScriptArg

 internal static extern WebDriverResult wdAddElementScriptArg(SafeScriptArgsHandle scriptArgs, SafeInternetExplorerWebElementHandle handle);
開發者ID:epall,項目名稱:selenium,代碼行數:1,代碼來源:NativeMethods.cs


注:本文中的OpenQA.Selenium.IE.SafeInternetExplorerWebElementHandle類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。