@@ -14,23 +14,22 @@ def test_clp001_clipboard_text(dash_dcc_headed):
14
14
app = dash .Dash (__name__ , prevent_initial_callbacks = True )
15
15
app .layout = html .Div (
16
16
[
17
- html .Div (copy_text , id = "copy1 " ),
18
- dcc .Clipboard (id = "copy_icon1 " , target_id = "copy1 " ),
19
- dcc .Textarea (id = "paste1 " ),
17
+ html .Div (copy_text , id = "copy " ),
18
+ dcc .Clipboard (id = "copy_icon " , target_id = "copy " ),
19
+ dcc .Textarea (id = "paste " ),
20
20
]
21
21
)
22
22
dash_dcc_headed .start_server (app )
23
- dash_dcc_headed .driver .execute_script ("navigator.clipboard.writeText('')" )
24
23
25
- dash_dcc_headed .find_element ("#copy_icon1 " ).click ()
26
- time .sleep (2 )
27
- dash_dcc_headed .find_element ("#paste1 " ).click ()
24
+ dash_dcc_headed .find_element ("#copy_icon " ).click ()
25
+ # time.sleep(2)
26
+ dash_dcc_headed .find_element ("#paste " ).click ()
28
27
ActionChains (dash_dcc_headed .driver ).key_down (Keys .CONTROL ).send_keys ("v" ).key_up (
29
28
Keys .CONTROL
30
29
).perform ()
31
30
32
31
wait .until (
33
- lambda : dash_dcc_headed .find_element ("#paste1 " ).get_attribute ("value" )
32
+ lambda : dash_dcc_headed .find_element ("#paste " ).get_attribute ("value" )
34
33
== copy_text ,
35
34
timeout = 3 ,
36
35
)
@@ -40,20 +39,19 @@ def test_clp002_clipboard_text(dash_dcc_headed):
40
39
copy_text = "Copy this text to the clipboard"
41
40
app = dash .Dash (__name__ , prevent_initial_callbacks = True )
42
41
app .layout = html .Div (
43
- [dcc .Clipboard (id = "copy_icon2 " , text = copy_text ), dcc .Textarea (id = "paste2 " )]
42
+ [dcc .Clipboard (id = "copy_icon " , text = copy_text ), dcc .Textarea (id = "paste " )]
44
43
)
45
44
dash_dcc_headed .start_server (app )
46
- dash_dcc_headed .driver .execute_script ("navigator.clipboard.writeText('')" )
47
45
48
- dash_dcc_headed .find_element ("#copy_icon2 " ).click ()
49
- time .sleep (2 )
50
- dash_dcc_headed .find_element ("#paste2 " ).click ()
46
+ dash_dcc_headed .find_element ("#copy_icon " ).click ()
47
+ time .sleep (1 )
48
+ dash_dcc_headed .find_element ("#paste " ).click ()
51
49
ActionChains (dash_dcc_headed .driver ).key_down (Keys .CONTROL ).send_keys ("v" ).key_up (
52
50
Keys .CONTROL
53
51
).perform ()
54
52
55
53
wait .until (
56
- lambda : dash_dcc_headed .find_element ("#paste2 " ).get_attribute ("value" )
54
+ lambda : dash_dcc_headed .find_element ("#paste " ).get_attribute ("value" )
57
55
== copy_text ,
58
56
timeout = 3 ,
59
57
)
0 commit comments