31
31
corresponding screenshots.
32
32
"""
33
33
34
- from __future__ import print_function
35
-
36
- from builtins import input
37
- from builtins import range
38
-
39
- try :
40
- from future import standard_library
41
- standard_library .install_aliases ()
42
- except :
43
- print ("Failed to import future module - missing install?" )
44
- exit (1 )
45
-
46
34
import getpass
47
35
import os
48
36
import sys
49
37
import time
50
38
import traceback
51
39
52
- if sys .version_info [0 ] >= 3 :
53
- from urllib .parse import urlparse
54
- else :
55
- from urlparse import urlparse
40
+ from urllib .parse import urlparse
56
41
57
42
try :
58
43
from mig .user .selenium .migcore import init_driver , ucph_login , mig_login , \
@@ -321,7 +306,7 @@ def archives_actions(driver, url, login, passwd, callbacks):
321
306
add_button .click ()
322
307
# TODO: figure out why this ajax_wait fails with V3
323
308
# Wait for fileman popup to accept click handlers
324
- #ajax_wait(driver, nav_name + " file select", "ui-progressbar")
309
+ # ajax_wait(driver, nav_name + " file select", "ui-progressbar")
325
310
state = 'archive-fileman'
326
311
if callbacks .get (state , None ):
327
312
print ("INFO: callback for: %s" % state )
@@ -333,12 +318,12 @@ def archives_actions(driver, url, login, passwd, callbacks):
333
318
for select_file in files_area .find_elements (by_what ('class_name' ),
334
319
"ext_txt" ):
335
320
try :
336
- #print("DEBUG: scroll to file elem: %s" % select_file)
321
+ # print("DEBUG: scroll to file elem: %s" % select_file)
337
322
scroll_to_elem (driver , select_file )
338
323
339
324
# TODO: figure out how to get this dclick working
340
325
# NOTE: dclick on same target hits a dir here after scroll!?
341
- #print("DEBUG: double click file elem: %s" % select_file)
326
+ # print("DEBUG: double click file elem: %s" % select_file)
342
327
doubleclick_elem (driver , select_file )
343
328
selected = True
344
329
except Exception as exc :
@@ -349,21 +334,21 @@ def archives_actions(driver, url, login, passwd, callbacks):
349
334
if not selected :
350
335
# NOTE: as a workaround we save path, cancel and manually fill for now
351
336
file_path = select_file .text
352
- #print("DEBUG: found file path: %s" % file_path)
337
+ # print("DEBUG: found file path: %s" % file_path)
353
338
# Use parent of unique filechooser to find the right dialog among many
354
339
filechooser_elem = driver .find_element (by_what ('id' ), "fm_filechooser" )
355
340
filechooser_dialog = filechooser_elem .parent
356
341
# print("DEBUG: found filechooser %s and parent dialog: %s" %
357
342
# (filechooser_elem, filechooser_dialog))
358
343
close_button = filechooser_dialog .find_element (
359
344
by_what ('class_name' ), "ui-dialog-titlebar-close" )
360
- #print("DEBUG: found close button: %s" % close_button)
345
+ # print("DEBUG: found close button: %s" % close_button)
361
346
close_button .click ()
362
347
# dialog_buttons = filechooser_dialog.find_element(by_what('class_name'),
363
348
# "ui-dialog-buttonset")
364
349
# action_buttons = dialog_buttons.find_elements(by_what('class_name'),
365
350
# "ui-button")
366
- #print("DEBUG: found action buttons: %s" % action_buttons)
351
+ # print("DEBUG: found action buttons: %s" % action_buttons)
367
352
# for button in action_buttons:
368
353
# print("DEBUG: checking action button: %s" % button)
369
354
# if button.text == 'Cancel':
@@ -389,7 +374,7 @@ def archives_actions(driver, url, login, passwd, callbacks):
389
374
390
375
submit_button = driver .find_element (by_what ('xpath' ),
391
376
"//input[@type='submit' and @value='Save and Preview']" )
392
- #print("DEBUG: click submit: %s" % submit_button)
377
+ # print("DEBUG: click submit: %s" % submit_button)
393
378
submit_button .click ()
394
379
395
380
state = 'archive-submitted'
@@ -404,11 +389,11 @@ def archives_actions(driver, url, login, passwd, callbacks):
404
389
405
390
finalize_button = driver .find_element (by_what ('class_name' ),
406
391
"finalizearchivelink" )
407
- #print("DEBUG: click finalize button: %s" % finalize_button)
392
+ # print("DEBUG: click finalize button: %s" % finalize_button)
408
393
finalize_button .click ()
409
394
410
395
# TMP! while testing
411
- #do_finalize = True
396
+ # do_finalize = True
412
397
do_finalize = False
413
398
finalized = False
414
399
confirm_elem = driver .find_element (by_what ('id' ), "confirm_dialog" )
@@ -421,11 +406,11 @@ def archives_actions(driver, url, login, passwd, callbacks):
421
406
"ui-button" )
422
407
for button in confirm_buttons :
423
408
if do_finalize and button .text == 'Yes' :
424
- #print("DEBUG: click confirm button: %s" % button.text)
409
+ # print("DEBUG: click confirm button: %s" % button.text)
425
410
button .click ()
426
411
finalized = True
427
412
if button .text == 'No' :
428
- #print("DEBUG: click confirm button: %s" % button.text)
413
+ # print("DEBUG: click confirm button: %s" % button.text)
429
414
button .click ()
430
415
# else:
431
416
# print("DEBUG: ignore confirm button: %s" % button.text)
@@ -434,7 +419,7 @@ def archives_actions(driver, url, login, passwd, callbacks):
434
419
print ("WARNING: failed to confirm finalize - force close dialog" )
435
420
close_button = confirm_dialog .find_element (by_what ('class_name' ),
436
421
"ui-dialog-titlebar-close" )
437
- #print("DEBUG: found close button: %s" % close_button)
422
+ # print("DEBUG: found close button: %s" % close_button)
438
423
close_button .click ()
439
424
440
425
state = 'archive-finalized'
@@ -443,7 +428,7 @@ def archives_actions(driver, url, login, passwd, callbacks):
443
428
callbacks [state ](driver , state )
444
429
445
430
view_button = driver .find_element (by_what ('class_name' ), "viewarchivelink" )
446
- #print("DEBUG: click view button: %s" % view_button)
431
+ # print("DEBUG: click view button: %s" % view_button)
447
432
view_button .click ()
448
433
ajax_wait (driver , nav_name )
449
434
state = 'archive-view'
@@ -454,7 +439,7 @@ def archives_actions(driver, url, login, passwd, callbacks):
454
439
if finalized :
455
440
register_button = driver .find_element (by_what ('class_name' ),
456
441
"registerarchivelink" )
457
- #print("DEBUG: click register button: %s" % register_button)
442
+ # print("DEBUG: click register button: %s" % register_button)
458
443
register_button .click ()
459
444
460
445
dialog_buttons = driver .find_element (by_what ('class_name' ),
@@ -474,7 +459,7 @@ def archives_actions(driver, url, login, passwd, callbacks):
474
459
print ("WARNING: failed to confirm register doi - force close dialog" )
475
460
close_button = confirm_dialog .find_element (
476
461
by_what ('class_name' ), "ui-dialog-titlebar-close" )
477
- #print("DEBUG: found close button: %s" % close_button)
462
+ # print("DEBUG: found close button: %s" % close_button)
478
463
close_button .click ()
479
464
480
465
# Redirecting to KU-IT DOI service where login may be required
@@ -484,7 +469,7 @@ def archives_actions(driver, url, login, passwd, callbacks):
484
469
# Maybe need KU-IT DOI service login if requested
485
470
try :
486
471
logon_button = driver .find_element (by_what ('id' ), "cmdLogon" )
487
- #print("DEBUG: click logon: %s" % logon_button)
472
+ # print("DEBUG: click logon: %s" % logon_button)
488
473
logon_button .click ()
489
474
except Exception as exc :
490
475
pass
@@ -498,7 +483,7 @@ def archives_actions(driver, url, login, passwd, callbacks):
498
483
password_field .send_keys (passwd )
499
484
submit_button = driver .find_element (by_what ('id' ),
500
485
"submitButton" )
501
- #print("DEBUG: click submit: %s" % submit_button)
486
+ # print("DEBUG: click submit: %s" % submit_button)
502
487
time .sleep (1 )
503
488
submit_button .click ()
504
489
login_done = True
@@ -525,7 +510,7 @@ def archives_actions(driver, url, login, passwd, callbacks):
525
510
break
526
511
# Then find and click accept button
527
512
if popup_dialog .is_displayed ():
528
- #print("DEBUG: found visible popup dialog")
513
+ # print("DEBUG: found visible popup dialog")
529
514
popup_found = True
530
515
popup_buttons = popup_dialog .find_elements (
531
516
by_what ('class_name' ), "btn" )
@@ -555,7 +540,7 @@ def archives_actions(driver, url, login, passwd, callbacks):
555
540
# print "DEBUG: found DOI identifier: %s" % doi_idenfier
556
541
break
557
542
except Exception as exc :
558
- #print("DEBUG: DOI page not ready: %s" % exc)
543
+ # print("DEBUG: DOI page not ready: %s" % exc)
559
544
pass
560
545
561
546
# Keep trying until we get through login and usage accept
@@ -624,7 +609,7 @@ def setup_actions(driver, url, login, passwd, callbacks):
624
609
# else:
625
610
# print("DEBUG: use sif setup sections: %s" % active_setup_sections)
626
611
627
- #print("DEBUG: run through setup section: %s" % active_setup_sections)
612
+ # print("DEBUG: run through setup section: %s" % active_setup_sections)
628
613
for (key , name ) in active_setup_sections :
629
614
# print("DEBUG: open setup section: %s" % name)
630
615
# Search inside page content to avoid Seafile nav menu interference
@@ -731,7 +716,7 @@ def peers_actions(driver, url, login, passwd, callbacks):
731
716
return
732
717
# print "DEBUG: found %s link: %s" % (nav_name, link)
733
718
link .click ()
734
- #ajax_wait(driver, nav_name)
719
+ # ajax_wait(driver, nav_name)
735
720
state = 'peers-ready'
736
721
if callbacks .get (state , None ):
737
722
print ("INFO: callback for: %s" % state )
@@ -1004,7 +989,7 @@ def main():
1004
989
1005
990
driver = init_driver (browser )
1006
991
# Make sure the screenshots have a suitable size
1007
- #driver.set_window_size(1400, 900)
992
+ # driver.set_window_size(1400, 900)
1008
993
driver .set_window_size (1680 , 1080 )
1009
994
try :
1010
995
driver .get (url )
0 commit comments