本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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();
}
示例5: wdeGetSize
internal static extern WebDriverResult wdeGetSize(SafeInternetExplorerWebElementHandle element, ref int width, ref int height);
示例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;
}
示例7: wdeGetLocation
internal static extern WebDriverResult wdeGetLocation(SafeInternetExplorerWebElementHandle element, ref int x, ref int y);
示例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;
}
示例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();
}
示例10: wdeIsDisplayed
internal static extern WebDriverResult wdeIsDisplayed(SafeInternetExplorerWebElementHandle handle, ref int displayed);
示例11: wdeSendKeys
internal static extern WebDriverResult wdeSendKeys(SafeInternetExplorerWebElementHandle wrapper, [MarshalAs(UnmanagedType.LPWStr)] string text);
示例12: wdGetElementScriptResult
internal static extern WebDriverResult wdGetElementScriptResult(SafeScriptResultHandle scriptResult, SafeInternetExplorerDriverHandle driver, out SafeInternetExplorerWebElementHandle value);
示例13: wdSwitchToActiveElement
internal static extern WebDriverResult wdSwitchToActiveElement(SafeInternetExplorerDriverHandle driver, ref SafeInternetExplorerWebElementHandle result);
示例14: wdFindElementsByXPath
internal static extern WebDriverResult wdFindElementsByXPath(SafeInternetExplorerDriverHandle driver, SafeInternetExplorerWebElementHandle element, [MarshalAs(UnmanagedType.LPWStr)] string xpath, ref SafeWebElementCollectionHandle result);
示例15: wdAddElementScriptArg
internal static extern WebDriverResult wdAddElementScriptArg(SafeScriptArgsHandle scriptArgs, SafeInternetExplorerWebElementHandle handle);