Skip to content

Commit bb27671

Browse files
committed
Adding ability to get wrapped IWebElement from SelectElement in .NET
When using a SelectElement wrapper class to manipulate <select> elements, the user previously had to keep a separate reference to the IWebElement representing the actual element. With this commit, the SelectElement class now implements IWrapsElement, exposing the WrappedElement property, which gives the user the ability to access the underlying IWebElement. This fixes issue #350.
1 parent 12c44b8 commit bb27671

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Diff for: dotnet/src/support/UI/SelectElement.cs

+10-1
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020
using System.Collections.Generic;
2121
using System.Globalization;
2222
using System.Text;
23+
using OpenQA.Selenium.Internal;
2324

2425
namespace OpenQA.Selenium.Support.UI
2526
{
2627
/// <summary>
2728
/// Provides a convenience method for manipulating selections of options in an HTML select element.
2829
/// </summary>
29-
public class SelectElement
30+
public class SelectElement : IWrapsElement
3031
{
3132
private readonly IWebElement element;
3233

@@ -55,6 +56,14 @@ public SelectElement(IWebElement element)
5556
this.IsMultiple = attribute != null && attribute.ToLowerInvariant() != "false";
5657
}
5758

59+
/// <summary>
60+
/// Gets the <see cref="IWebElement"/> wrapped by this object.
61+
/// </summary>
62+
public IWebElement WrappedElement
63+
{
64+
get { return this.element; }
65+
}
66+
5867
/// <summary>
5968
/// Gets a value indicating whether the parent element supports multiple selections.
6069
/// </summary>

0 commit comments

Comments
 (0)