@@ -6,11 +6,15 @@ namespace OpenQA.Selenium.BiDi.Modules.Input;
66
77public interface ISequentialSourceActions : IEnumerable < SourceActions >
88{
9- public ISequentialSourceActions Pause ( int duration ) ;
9+ ISequentialSourceActions Pause ( int duration ) ;
1010
11- public ISequentialSourceActions Type ( string text ) ;
11+ ISequentialSourceActions Type ( string text ) ;
12+ ISequentialSourceActions KeyDown ( char key ) ;
13+ ISequentialSourceActions KeyUp ( char key ) ;
1214
13- public ISequentialSourceActions KeyDown ( char key ) ;
15+ ISequentialSourceActions PointerDown ( int button , PointerDownOptions ? options = null ) ;
16+ ISequentialSourceActions PointerUp ( int button ) ;
17+ ISequentialSourceActions PointerMove ( int x , int y , PointerMoveOptions ? options = null ) ;
1418}
1519
1620public record SequentialSourceActions : ISequentialSourceActions
@@ -41,6 +45,54 @@ public ISequentialSourceActions KeyDown(char key)
4145 return Normalized ( ) ;
4246 }
4347
48+ public ISequentialSourceActions KeyUp ( char key )
49+ {
50+ _keyActions . Add ( new Key . Up ( key ) ) ;
51+
52+ return Normalized ( ) ;
53+ }
54+
55+ public ISequentialSourceActions PointerDown ( int button , PointerDownOptions ? options = null )
56+ {
57+ _pointerActions . Add ( new Pointer . Down ( button )
58+ {
59+ Width = options ? . Width ,
60+ Height = options ? . Height ,
61+ Pressure = options ? . Pressure ,
62+ TangentialPressure = options ? . TangentialPressure ,
63+ Twist = options ? . Twist ,
64+ AltitudeAngle = options ? . AltitudeAngle ,
65+ AzimuthAngle = options ? . AzimuthAngle
66+ } ) ;
67+
68+ return Normalized ( ) ;
69+ }
70+
71+ public ISequentialSourceActions PointerUp ( int button )
72+ {
73+ _pointerActions . Add ( new Pointer . Up ( button ) ) ;
74+
75+ return Normalized ( ) ;
76+ }
77+
78+ public ISequentialSourceActions PointerMove ( int x , int y , PointerMoveOptions ? options = null )
79+ {
80+ _pointerActions . Add ( new Pointer . Move ( x , y )
81+ {
82+ Duration = options ? . Duration ,
83+ Origin = options ? . Origin ,
84+ Width = options ? . Width ,
85+ Height = options ? . Height ,
86+ Pressure = options ? . Pressure ,
87+ TangentialPressure = options ? . TangentialPressure ,
88+ Twist = options ? . Twist ,
89+ AltitudeAngle = options ? . AltitudeAngle ,
90+ AzimuthAngle = options ? . AzimuthAngle
91+ } ) ;
92+
93+ return Normalized ( ) ;
94+ }
95+
4496 private SequentialSourceActions Normalized ( )
4597 {
4698 var max = new [ ] { _keyActions . Count ( ) , _pointerActions . Count ( ) , _wheelActions . Count ( ) , _noneActions . Count ( ) } . Max ( ) ;
@@ -82,3 +134,28 @@ public IEnumerator<SourceActions> GetEnumerator()
82134
83135 IEnumerator IEnumerable . GetEnumerator ( ) => GetEnumerator ( ) ;
84136}
137+
138+ public record PointerDownOptions : IPointerCommonProperties
139+ {
140+ public int ? Width { get ; set ; }
141+ public int ? Height { get ; set ; }
142+ public double ? Pressure { get ; set ; }
143+ public double ? TangentialPressure { get ; set ; }
144+ public int ? Twist { get ; set ; }
145+ public double ? AltitudeAngle { get ; set ; }
146+ public double ? AzimuthAngle { get ; set ; }
147+ }
148+
149+ public record PointerMoveOptions : IPointerCommonProperties
150+ {
151+ public int ? Duration { get ; set ; }
152+ public Origin ? Origin { get ; set ; }
153+
154+ public int ? Width { get ; set ; }
155+ public int ? Height { get ; set ; }
156+ public double ? Pressure { get ; set ; }
157+ public double ? TangentialPressure { get ; set ; }
158+ public int ? Twist { get ; set ; }
159+ public double ? AltitudeAngle { get ; set ; }
160+ public double ? AzimuthAngle { get ; set ; }
161+ }
0 commit comments