@@ -76,7 +76,7 @@ public IWebDriver WrappedDriver
76
76
/// "input" for an element specified by the HTML markup <input name="foo" />.
77
77
/// </remarks>
78
78
/// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
79
- public string TagName
79
+ public virtual string TagName
80
80
{
81
81
get
82
82
{
@@ -92,7 +92,7 @@ public string TagName
92
92
/// and with other whitespace collapsed.
93
93
/// </summary>
94
94
/// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
95
- public string Text
95
+ public virtual string Text
96
96
{
97
97
get
98
98
{
@@ -109,7 +109,7 @@ public string Text
109
109
/// <remarks>The <see cref="Enabled"/> property will generally
110
110
/// return <see langword="true"/> for everything except explicitly disabled input elements.</remarks>
111
111
/// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
112
- public bool Enabled
112
+ public virtual bool Enabled
113
113
{
114
114
get
115
115
{
@@ -126,7 +126,7 @@ public bool Enabled
126
126
/// <remarks>This operation only applies to input elements such as checkboxes,
127
127
/// options in a select element and radio buttons.</remarks>
128
128
/// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
129
- public bool Selected
129
+ public virtual bool Selected
130
130
{
131
131
get
132
132
{
@@ -142,7 +142,7 @@ public bool Selected
142
142
/// of this element relative to the upper-left corner of the page.
143
143
/// </summary>
144
144
/// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
145
- public Point Location
145
+ public virtual Point Location
146
146
{
147
147
get
148
148
{
@@ -166,7 +166,7 @@ public Point Location
166
166
/// Gets a <see cref="Size"/> object containing the height and width of this element.
167
167
/// </summary>
168
168
/// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
169
- public Size Size
169
+ public virtual Size Size
170
170
{
171
171
get
172
172
{
@@ -193,7 +193,7 @@ public Size Size
193
193
/// of having to parse an element's "style" attribute to determine
194
194
/// visibility of an element.</remarks>
195
195
/// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
196
- public bool Displayed
196
+ public virtual bool Displayed
197
197
{
198
198
get
199
199
{
@@ -219,7 +219,7 @@ public bool Displayed
219
219
/// <summary>
220
220
/// Gets the point where the element would be when scrolled into view.
221
221
/// </summary>
222
- public Point LocationOnScreenOnceScrolledIntoView
222
+ public virtual Point LocationOnScreenOnceScrolledIntoView
223
223
{
224
224
get
225
225
{
@@ -248,7 +248,7 @@ public Point LocationOnScreenOnceScrolledIntoView
248
248
/// Gets the coordinates identifying the location of this element using
249
249
/// various frames of reference.
250
250
/// </summary>
251
- public ICoordinates Coordinates
251
+ public virtual ICoordinates Coordinates
252
252
{
253
253
get { return new RemoteCoordinates ( this ) ; }
254
254
}
@@ -283,7 +283,7 @@ protected string Id
283
283
/// method will clear the value. It has no effect on other elements. Text entry elements
284
284
/// are defined as elements with INPUT or TEXTAREA tags.</remarks>
285
285
/// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
286
- public void Clear ( )
286
+ public virtual void Clear ( )
287
287
{
288
288
Dictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
289
289
parameters . Add ( "id" , this . elementId ) ;
@@ -301,7 +301,7 @@ public void Clear()
301
301
/// <exception cref="InvalidElementStateException">Thrown when the target element is not enabled.</exception>
302
302
/// <exception cref="ElementNotVisibleException">Thrown when the target element is not visible.</exception>
303
303
/// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
304
- public void SendKeys ( string text )
304
+ public virtual void SendKeys ( string text )
305
305
{
306
306
if ( text == null )
307
307
{
@@ -342,7 +342,7 @@ public void SendKeys(string text)
342
342
/// page to change, then this method will attempt to block until the new page
343
343
/// is loaded.</remarks>
344
344
/// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
345
- public void Submit ( )
345
+ public virtual void Submit ( )
346
346
{
347
347
if ( this . driver . IsSpecificationCompliant )
348
348
{
@@ -382,7 +382,7 @@ public void Submit()
382
382
/// <exception cref="InvalidElementStateException">Thrown when the target element is not enabled.</exception>
383
383
/// <exception cref="ElementNotVisibleException">Thrown when the target element is not visible.</exception>
384
384
/// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
385
- public void Click ( )
385
+ public virtual void Click ( )
386
386
{
387
387
Dictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
388
388
parameters . Add ( "id" , this . elementId ) ;
@@ -423,7 +423,7 @@ public void Click()
423
423
/// </list>
424
424
/// </remarks>
425
425
/// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
426
- public string GetAttribute ( string attributeName )
426
+ public virtual string GetAttribute ( string attributeName )
427
427
{
428
428
Response commandResponse = null ;
429
429
string attributeValue = string . Empty ;
@@ -467,7 +467,7 @@ public string GetAttribute(string attributeName)
467
467
/// <returns>The JavaScript property's current value. Returns a <see langword="null"/> if the
468
468
/// value is not set or the property does not exist.</returns>
469
469
/// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
470
- public string GetProperty ( string propertyName )
470
+ public virtual string GetProperty ( string propertyName )
471
471
{
472
472
string propertyValue = string . Empty ;
473
473
Dictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
@@ -498,7 +498,7 @@ public string GetProperty(string propertyName)
498
498
/// "background-color" property set as "green" in the HTML source, will
499
499
/// return "#008000" for its value.</remarks>
500
500
/// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
501
- public string GetCssValue ( string propertyName )
501
+ public virtual string GetCssValue ( string propertyName )
502
502
{
503
503
Dictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
504
504
parameters . Add ( "id" , this . Id ) ;
@@ -522,7 +522,7 @@ public string GetCssValue(string propertyName)
522
522
/// <param name="by">The locating mechanism to use.</param>
523
523
/// <returns>A <see cref="ReadOnlyCollection{T}"/> of all <see cref="IWebElement">WebElements</see>
524
524
/// matching the current criteria, or an empty list if nothing matches.</returns>
525
- public ReadOnlyCollection < IWebElement > FindElements ( By by )
525
+ public virtual ReadOnlyCollection < IWebElement > FindElements ( By by )
526
526
{
527
527
if ( by == null )
528
528
{
@@ -538,7 +538,7 @@ public ReadOnlyCollection<IWebElement> FindElements(By by)
538
538
/// <param name="by">The locating mechanism to use.</param>
539
539
/// <returns>The first matching <see cref="IWebElement"/> on the current context.</returns>
540
540
/// <exception cref="NoSuchElementException">If no element matches the criteria.</exception>
541
- public IWebElement FindElement ( By by )
541
+ public virtual IWebElement FindElement ( By by )
542
542
{
543
543
if ( by == null )
544
544
{
@@ -559,7 +559,7 @@ public IWebElement FindElement(By by)
559
559
/// IWebElement elem = driver.FindElementByLinkText("linktext")
560
560
/// </code>
561
561
/// </example>
562
- public IWebElement FindElementByLinkText ( string linkText )
562
+ public virtual IWebElement FindElementByLinkText ( string linkText )
563
563
{
564
564
return this . FindElement ( "link text" , linkText ) ;
565
565
}
@@ -575,7 +575,7 @@ public IWebElement FindElementByLinkText(string linkText)
575
575
/// ReadOnlyCollection<![CDATA[<IWebElement>]]> elem = driver.FindElementsByLinkText("linktext")
576
576
/// </code>
577
577
/// </example>
578
- public ReadOnlyCollection < IWebElement > FindElementsByLinkText ( string linkText )
578
+ public virtual ReadOnlyCollection < IWebElement > FindElementsByLinkText ( string linkText )
579
579
{
580
580
return this . FindElements ( "link text" , linkText ) ;
581
581
}
@@ -591,7 +591,7 @@ public ReadOnlyCollection<IWebElement> FindElementsByLinkText(string linkText)
591
591
/// IWebElement elem = driver.FindElementById("id")
592
592
/// </code>
593
593
/// </example>
594
- public IWebElement FindElementById ( string id )
594
+ public virtual IWebElement FindElementById ( string id )
595
595
{
596
596
if ( this . driver . IsSpecificationCompliant )
597
597
{
@@ -612,7 +612,7 @@ public IWebElement FindElementById(string id)
612
612
/// ReadOnlyCollection<![CDATA[<IWebElement>]]> elem = driver.FindElementsById("id")
613
613
/// </code>
614
614
/// </example>
615
- public ReadOnlyCollection < IWebElement > FindElementsById ( string id )
615
+ public virtual ReadOnlyCollection < IWebElement > FindElementsById ( string id )
616
616
{
617
617
if ( this . driver . IsSpecificationCompliant )
618
618
{
@@ -633,7 +633,7 @@ public ReadOnlyCollection<IWebElement> FindElementsById(string id)
633
633
/// elem = driver.FindElementsByName("name")
634
634
/// </code>
635
635
/// </example>
636
- public IWebElement FindElementByName ( string name )
636
+ public virtual IWebElement FindElementByName ( string name )
637
637
{
638
638
// Element finding mechanism is not allowed by the W3C WebDriver
639
639
// specification, but rather should be implemented as a function
@@ -660,7 +660,7 @@ public IWebElement FindElementByName(string name)
660
660
/// ReadOnlyCollection<![CDATA[<IWebElement>]]> elem = driver.FindElementsByName("name")
661
661
/// </code>
662
662
/// </example>
663
- public ReadOnlyCollection < IWebElement > FindElementsByName ( string name )
663
+ public virtual ReadOnlyCollection < IWebElement > FindElementsByName ( string name )
664
664
{
665
665
// Element finding mechanism is not allowed by the W3C WebDriver
666
666
// specification, but rather should be implemented as a function
@@ -687,7 +687,7 @@ public ReadOnlyCollection<IWebElement> FindElementsByName(string name)
687
687
/// IWebElement elem = driver.FindElementsByTagName("tag")
688
688
/// </code>
689
689
/// </example>
690
- public IWebElement FindElementByTagName ( string tagName )
690
+ public virtual IWebElement FindElementByTagName ( string tagName )
691
691
{
692
692
// Element finding mechanism is not allowed by the W3C WebDriver
693
693
// specification, but rather should be implemented as a function
@@ -714,7 +714,7 @@ public IWebElement FindElementByTagName(string tagName)
714
714
/// ReadOnlyCollection<![CDATA[<IWebElement>]]> elem = driver.FindElementsByTagName("tag")
715
715
/// </code>
716
716
/// </example>
717
- public ReadOnlyCollection < IWebElement > FindElementsByTagName ( string tagName )
717
+ public virtual ReadOnlyCollection < IWebElement > FindElementsByTagName ( string tagName )
718
718
{
719
719
// Element finding mechanism is not allowed by the W3C WebDriver
720
720
// specification, but rather should be implemented as a function
@@ -741,7 +741,7 @@ public ReadOnlyCollection<IWebElement> FindElementsByTagName(string tagName)
741
741
/// IWebElement elem = driver.FindElementByClassName("classname")
742
742
/// </code>
743
743
/// </example>
744
- public IWebElement FindElementByClassName ( string className )
744
+ public virtual IWebElement FindElementByClassName ( string className )
745
745
{
746
746
// Element finding mechanism is not allowed by the W3C WebDriver
747
747
// specification, but rather should be implemented as a function
@@ -768,7 +768,7 @@ public IWebElement FindElementByClassName(string className)
768
768
/// ReadOnlyCollection<![CDATA[<IWebElement>]]> elem = driver.FindElementsByClassName("classname")
769
769
/// </code>
770
770
/// </example>
771
- public ReadOnlyCollection < IWebElement > FindElementsByClassName ( string className )
771
+ public virtual ReadOnlyCollection < IWebElement > FindElementsByClassName ( string className )
772
772
{
773
773
// Element finding mechanism is not allowed by the W3C WebDriver
774
774
// specification, but rather should be implemented as a function
@@ -795,7 +795,7 @@ public ReadOnlyCollection<IWebElement> FindElementsByClassName(string className)
795
795
/// IWebElement elem = driver.FindElementsByXPath("//table/tbody/tr/td/a");
796
796
/// </code>
797
797
/// </example>
798
- public IWebElement FindElementByXPath ( string xpath )
798
+ public virtual IWebElement FindElementByXPath ( string xpath )
799
799
{
800
800
return this . FindElement ( "xpath" , xpath ) ;
801
801
}
@@ -811,7 +811,7 @@ public IWebElement FindElementByXPath(string xpath)
811
811
/// ReadOnlyCollection<![CDATA[<IWebElement>]]> elem = driver.FindElementsByXpath("//tr/td/a")
812
812
/// </code>
813
813
/// </example>
814
- public ReadOnlyCollection < IWebElement > FindElementsByXPath ( string xpath )
814
+ public virtual ReadOnlyCollection < IWebElement > FindElementsByXPath ( string xpath )
815
815
{
816
816
return this . FindElements ( "xpath" , xpath ) ;
817
817
}
@@ -827,7 +827,7 @@ public ReadOnlyCollection<IWebElement> FindElementsByXPath(string xpath)
827
827
/// IWebElement elem = driver.FindElementsByPartialLinkText("partOfLink")
828
828
/// </code>
829
829
/// </example>
830
- public IWebElement FindElementByPartialLinkText ( string partialLinkText )
830
+ public virtual IWebElement FindElementByPartialLinkText ( string partialLinkText )
831
831
{
832
832
return this . FindElement ( "partial link text" , partialLinkText ) ;
833
833
}
@@ -843,7 +843,7 @@ public IWebElement FindElementByPartialLinkText(string partialLinkText)
843
843
/// ReadOnlyCollection<![CDATA[<IWebElement>]]> elem = driver.FindElementsByPartialLinkText("partOfTheLink")
844
844
/// </code>
845
845
/// </example>
846
- public ReadOnlyCollection < IWebElement > FindElementsByPartialLinkText ( string partialLinkText )
846
+ public virtual ReadOnlyCollection < IWebElement > FindElementsByPartialLinkText ( string partialLinkText )
847
847
{
848
848
return this . FindElements ( "partial link text" , partialLinkText ) ;
849
849
}
@@ -853,7 +853,7 @@ public ReadOnlyCollection<IWebElement> FindElementsByPartialLinkText(string part
853
853
/// </summary>
854
854
/// <param name="cssSelector">The id to match.</param>
855
855
/// <returns>The first <see cref="IWebElement"/> matching the criteria.</returns>
856
- public IWebElement FindElementByCssSelector ( string cssSelector )
856
+ public virtual IWebElement FindElementByCssSelector ( string cssSelector )
857
857
{
858
858
return this . FindElement ( "css selector" , cssSelector ) ;
859
859
}
@@ -864,7 +864,7 @@ public IWebElement FindElementByCssSelector(string cssSelector)
864
864
/// <param name="cssSelector">The CSS selector to match.</param>
865
865
/// <returns>A <see cref="ReadOnlyCollection{T}"/> containing all
866
866
/// <see cref="IWebElement">IWebElements</see> matching the criteria.</returns>
867
- public ReadOnlyCollection < IWebElement > FindElementsByCssSelector ( string cssSelector )
867
+ public virtual ReadOnlyCollection < IWebElement > FindElementsByCssSelector ( string cssSelector )
868
868
{
869
869
return this . FindElements ( "css selector" , cssSelector ) ;
870
870
}
@@ -873,7 +873,7 @@ public ReadOnlyCollection<IWebElement> FindElementsByCssSelector(string cssSelec
873
873
/// Gets a <see cref="Screenshot"/> object representing the image of this element on the screen.
874
874
/// </summary>
875
875
/// <returns>A <see cref="Screenshot"/> object containing the image.</returns>
876
- public Screenshot GetScreenshot ( )
876
+ public virtual Screenshot GetScreenshot ( )
877
877
{
878
878
Dictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
879
879
parameters . Add ( "id" , this . elementId ) ;
@@ -963,7 +963,7 @@ Dictionary<string, object> IWebElementReference.ToDictionary()
963
963
/// <param name="mechanism">The mechanism by which to find the element.</param>
964
964
/// <param name="value">The value to use to search for the element.</param>
965
965
/// <returns>The first <see cref="IWebElement"/> matching the given criteria.</returns>
966
- protected IWebElement FindElement ( string mechanism , string value )
966
+ protected virtual IWebElement FindElement ( string mechanism , string value )
967
967
{
968
968
Dictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
969
969
parameters . Add ( "id" , this . elementId ) ;
@@ -979,8 +979,7 @@ protected IWebElement FindElement(string mechanism, string value)
979
979
/// <param name="mechanism">The mechanism by which to find the elements.</param>
980
980
/// <param name="value">The value to use to search for the elements.</param>
981
981
/// <returns>A collection of all of the <see cref="IWebElement">IWebElements</see> matching the given criteria.</returns>
982
- protected ReadOnlyCollection < IWebElement > FindElements ( string mechanism , string value )
983
- {
982
+ protected virtual ReadOnlyCollection < IWebElement > FindElements ( string mechanism , string value ) {
984
983
Dictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
985
984
parameters . Add ( "id" , this . elementId ) ;
986
985
parameters . Add ( "using" , mechanism ) ;
@@ -995,7 +994,7 @@ protected ReadOnlyCollection<IWebElement> FindElements(string mechanism, string
995
994
/// <param name="commandToExecute">The <see cref="DriverCommand"/> to execute against this element.</param>
996
995
/// <param name="parameters">A <see cref="Dictionary{K, V}"/> containing names and values of the parameters for the command.</param>
997
996
/// <returns>The <see cref="Response"/> object containing the result of the command execution.</returns>
998
- protected Response Execute ( string commandToExecute , Dictionary < string , object > parameters )
997
+ protected virtual Response Execute ( string commandToExecute , Dictionary < string , object > parameters )
999
998
{
1000
999
return this . driver . InternalExecute ( commandToExecute , parameters ) ;
1001
1000
}
0 commit comments