-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#542 New
TypesTextUsingFocusBehaviorAndSendKeysAttribute
- Loading branch information
1 parent
3e63b09
commit 74ed2fa
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/Atata/Attributes/Behaviors/TextType/TypesTextUsingFocusBehaviorAndSendKeysAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using OpenQA.Selenium; | ||
|
||
namespace Atata | ||
{ | ||
/// <summary> | ||
/// Represents the behavior for control text typing by executing <see cref="FocusBehaviorAttribute"/> behavior | ||
/// and then invoking <see cref="IWebElement.SendKeys(string)"/> method. | ||
/// </summary> | ||
public class TypesTextUsingFocusBehaviorAndSendKeysAttribute : TypesTextUsingSendKeysAttribute | ||
{ | ||
/// <inheritdoc/> | ||
public override void Execute<TOwner>(IUIComponent<TOwner> component, string value) | ||
{ | ||
if (!string.IsNullOrEmpty(value)) | ||
{ | ||
AtataContext.Current.UIComponentScopeCache.ExecuteWithin(() => | ||
{ | ||
component.ExecuteBehavior<FocusBehaviorAttribute>(x => x.Execute(component)); | ||
|
||
base.Execute(component, value); | ||
}); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters