File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
examples/javascript/test/actionsApi/mouse Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ const { By} = require ( 'selenium-webdriver' ) ;
2
+ const { suite} = require ( 'selenium-webdriver/testing' ) ;
3
+ const assert = require ( 'assert' ) ;
4
+
5
+ suite ( function ( env ) {
6
+ describe ( 'Drag and Drop' , function ( ) {
7
+ let driver ;
8
+
9
+ before ( async function ( ) {
10
+ driver = await env . builder ( ) . build ( ) ;
11
+ } ) ;
12
+
13
+ after ( async ( ) => await driver . quit ( ) ) ;
14
+
15
+ it ( 'By Offset' , async function ( ) {
16
+ await driver . get ( 'https://www.selenium.dev/selenium/web/mouse_interaction.html' ) ;
17
+ const draggable = driver . findElement ( By . id ( "draggable" ) ) ;
18
+ let start = await draggable . getRect ( ) ;
19
+ let finish = await driver . findElement ( By . id ( "droppable" ) ) . getRect ( ) ;
20
+ const actions = driver . actions ( { async : true } ) ;
21
+ await actions . dragAndDrop ( draggable , { x : finish . x - start . x , y : finish . y - start . y } ) . perform ( ) ;
22
+
23
+ let result = await driver . findElement ( By . id ( "drop-status" ) ) . getText ( ) ;
24
+ assert . deepStrictEqual ( 'dropped' , result )
25
+ } ) ;
26
+ } ) ;
27
+ } ) ;
You can’t perform that action at this time.
0 commit comments