File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ """
2
+ self.show_file_choosers() is used to show hidden file-upload fields.
3
+ Verify that one can choose a file after the hidden input is visible.
4
+ """
5
+ import os
6
+ from seleniumbase import BaseCase
7
+
8
+
9
+ class FileUpload (BaseCase ):
10
+ def test_show_file_choosers (self ):
11
+ self .open ("https://imgbb.com/upload" )
12
+ choose_file_selector = 'input[type="file"]'
13
+ uploaded_image = "#anywhere-upload-queue li.queue-item"
14
+ self .assert_element_not_visible (choose_file_selector )
15
+ self .show_file_choosers ()
16
+ self .assert_element (choose_file_selector )
17
+ self .assert_attribute (choose_file_selector , "value" , "" )
18
+ self .assert_element_not_visible (uploaded_image )
19
+ dir_name = os .path .dirname (os .path .abspath (__file__ ))
20
+ my_file = "screenshot.png"
21
+ file_path = os .path .join (dir_name , "example_logs/%s" % my_file )
22
+ self .choose_file (choose_file_selector , file_path )
23
+ seen_path = "%s\\ %s" % ("C:\\ fakepath" , my_file )
24
+ self .assert_attribute (choose_file_selector , "value" , seen_path )
25
+ self .demo_mode = True
26
+ self .assert_element (uploaded_image )
You can’t perform that action at this time.
0 commit comments