summaryrefslogtreecommitdiff
path: root/common/ui_common/profiles/ssl_decryption_profiles.py
blob: 786a3bd633045ff647e9089eed992401d779bbac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
# -*- coding: UTF-8 -*-
import time

from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException

from common.driver_common.mywebdriver import MyWebDriver
from selenium.webdriver.common.by import By
from config.workpath import workdir
from page_element.policies_element_position import *
from page_element.profiles_element_position import *
from common.driver_common.screenshot import screenshot_on_failure
from common.driver_common.random_name import RandomName
from common.ui_common.profiles.profiles_public_operations import ProfilesPublicOperations
import pytest_check
import inspect
from common.ui_common.login_logout.loginout import LogInOut


import random

import configparser
import os
from selenium import webdriver
import copy
from selenium.webdriver.common.keys import Keys
class SSLDecryptionProfiles:
    def __init__(self, demo_fixture: MyWebDriver):
        self.workdir = workdir
        self.my_random = RandomName()
        self.driver = demo_fixture
        # 调用profiles公共方法操作、删除、查询,
        self.profiles_po = ProfilesPublicOperations(self.driver)

    def sslDecryptionProfiles_case(self, data: {}):
        self._create(data)      #创建
        self._query(data, require_assertion=1, Name=self.random_name)     #创建后查询
        if data["model"].strip().lower() == "modify":   #修改测试时,执行修改方法
            self._modify(data)
            self._query(data, require_assertion=2, ID=self.first_row_ID_content)
        self._del()

    @screenshot_on_failure
    def _goto_subProfilePage(self, vsys_name_2=""):
        # 菜单操作,定位到ssl_decryption_keyrings列表页
        # self.driver.find_element(By.CSS_SELECTOR, mainPage_navigationBar_logo_posCss).click()
        self.profiles_po.change_vsys(vsys_name=vsys_name_2)
        self.driver.find_element(By.ID, mainPage_firstLevelMenu_profiles_posId).click()
        self.driver.find_element(By.ID, mainPage_secondLevelMenu_sslDecryptionProfiles_posId).click()

    def _goto_vsysPage(self, vsys_name_2=""):
        # 菜单操作,定位到不同的vsys
        self.profiles_po.change_vsys(vsys_name=vsys_name_2)

    @screenshot_on_failure
    def _create(self, data: {}, *source_name):
        #页面跳转
        self._goto_subProfilePage()
        #创建
        #点击create
        self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_createButton_posId).click()
        #在create 创建页面操作
        if source_name:
            self.random_name = source_name[0]
            self.driver.find_element(By.ID, sslDecryptionProfiles_input_Name_posId).send_keys(self.random_name)
        else:
            self.random_name = self.my_random.random_name()
            self.driver.find_element(By.ID, sslDecryptionProfiles_input_Name_posId).send_keys(self.random_name)
        #页面其它选项操作
        self._operate_page(data, operation_type="create")
        #点击OK
        self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_oK_posCss).click()
        if len(self.random_name) < 4:  # name不符合要求
            if self.driver.element_isExist(By.XPATH, "//label[text()='Name']/parent::div//div[@class='el-form-item__error']"):
                print("The length of the name is at most 128 characters and cannot be less than 4 characters")
                pytest_check.equal(
                    self.driver.find_element(By.XPATH, "//div[@class='el-form-item__error']").text.strip(),
                    "The length of the name is at most 128 characters and cannot be less than 4 characters",
                    msg="所在行数{}".format(inspect.currentframe().f_lineno))
            else:
                print("name less than 4,no error message")
            # 点击取消
            self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_cancel_posCss).click()
            self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_warningSaveYes_posCss).click()
        #数据正确输入时
        elif self.driver.element_isExist(By.CSS_SELECTOR, sslDecryptionProfiles_button_warningSaveYes_posCss):
            self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_warningSaveYes_posCss).click()
            time.sleep(1)
            # print(self.driver.element_isExist(By.XPATH, "//div[@class='edit-page']"), self.driver.element_isExist(By.XPATH, "//p[@class='el-message__content']"))
            edit_page = self.driver.element_isExist(By.XPATH, "//div[@class='edit-page']")
            error_message = self.driver.element_isExist(By.XPATH, "//p[@class='el-message__content']")
            print("test=", edit_page, error_message)
            if (edit_page == True) and (error_message == True):
                    mirror_client_versions_class = self.driver.find_element(By.XPATH, sslDecryptionProfiles_switch_mirrorClientVersions_posXpath).get_attribute("class")  # 该开关当前属性状态
                    error_content = self.driver.find_element(By.XPATH, "//p[@class='el-message__content']").text.strip()
                    if "is-checked" not in mirror_client_versions_class:  # 当前状态为关时,才可以操作版本大小
                        version_index_list = ['sslv3.0', 'tlsv1.0', 'tlsv1.1', 'tlsv1.2', 'tlsv1.3']
                        min_version = self.driver.find_element(By.XPATH, "//label[text()='Min Version']/parent::div//input").get_attribute("value").lower()
                        max_version = self.driver.find_element(By.XPATH, "//label[text()='Max Version']/parent::div//input").get_attribute("value").lower()
                        # print("version=", min_version, max_version)
                        if version_index_list.index(max_version) < version_index_list.index(min_version):
                            print("error_content=", error_content)
                            pytest_check.is_in( "In Protocol version, min version can't greater than max version", error_content, msg="所在行数{}".format(inspect.currentframe().f_lineno))
                            self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_cancel_posCss).click()
                            time.sleep(1)
                            if self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_warningSaveYes_posCss).is_displayed():
                                self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_warningSaveYes_posCss).click()
        return self.random_name

    def _operate_page(self, data: {}, operation_type="create"):
        """"""
        if operation_type == "create":
            data_index = 0   #新增数据索引
        else:
            data_index = -1   #编辑数据索引
        no_modify = "不修改"
        #解析输入data数据的数据
        #页面开关操作 common name,issuer,selfSigned,expiryDate
        self._operate_switch(data, data_index=data_index, no_modify=no_modify, switch_name="common_name", element_position=sslDecryptionProfiles_switch_commonName_posXpath)
        self._operate_switch(data, data_index=data_index, no_modify=no_modify, switch_name="issuer", element_position=sslDecryptionProfiles_switch_issuer_posXpath)
        self._operate_switch(data, data_index=data_index, no_modify=no_modify, switch_name="self_signed", element_position=sslDecryptionProfiles_switch_selfSigned_posXpath)
        self._operate_switch(data, data_index=data_index, no_modify=no_modify,  switch_name="expiry_date", element_position=sslDecryptionProfiles_switch_expiryDate_posXpath)
        #Fail Action操作
        fail_action = self._get_value_from_data(data, key="fail_action", data_index=data_index)    #用例数据提取 Pass-through   Fail-close
        if fail_action != no_modify:
            if "pass-through" == fail_action:        #点击pass through
                self.driver.find_element(By.XPATH, sslDecryptionProfiles_radio_passThrough_posXpath).click()
            else:                                    #点击fail close
                self.driver.find_element(By.XPATH, sslDecryptionProfiles_radio_failClose_posXpath).click()
        #页面开关操作ev_certificate  certificate_transparency mutual_authentication protocol_errors certificate_pinning certificate_not_installed allow_HTTP2 mirror_client_versions
        self._operate_switch(data, data_index=data_index, no_modify=no_modify, switch_name="ev_certificate", element_position=sslDecryptionProfiles_switch_evCert_posXpath)
        self._operate_switch(data, data_index=data_index, no_modify=no_modify, switch_name="certificate_transparency", element_position=sslDecryptionProfiles_switch_certificateTransparency_posXpath)
        self._operate_switch(data, data_index=data_index, no_modify=no_modify, switch_name="mutual_authentication", element_position=sslDecryptionProfiles_switch_mutualAuthentication_posXpath)
        self._operate_switch(data, data_index=data_index, no_modify=no_modify, switch_name="protocol_errors", element_position=sslDecryptionProfiles_switch_onProtocolErrors_posXpath)
        self._operate_switch(data, data_index=data_index, no_modify=no_modify, switch_name="certificate_pinning", element_position=sslDecryptionProfiles_switch_certificatePinning_posXpath)
        self._operate_switch(data, data_index=data_index, no_modify=no_modify, switch_name="certificate_not_installed", element_position=sslDecryptionProfiles_switch_certificateNotInstalled_posXpath)
        self._operate_switch(data, data_index=data_index, no_modify=no_modify, switch_name="mirror_client_versions", element_position=sslDecryptionProfiles_switch_mirrorClientVersions_posXpath)
        self._operate_switch(data, data_index=data_index, no_modify=no_modify, switch_name="allow_HTTP2", element_position=sslDecryptionProfiles_switch_allowHTTP2_posXpath)
        #Min Max version操作
        mirror_client_versions = self._get_value_from_data(data, key="mirror_client_versions", data_index=data_index)   #提取数据
        mirror_client_versions_class = self.driver.find_element(By.XPATH, sslDecryptionProfiles_switch_mirrorClientVersions_posXpath).get_attribute("class")   #该开关当前属性状态
        allowHTTP2_class = self.driver.find_element(By.XPATH, sslDecryptionProfiles_switch_allowHTTP2_posXpath).get_attribute("class")  # 该开关当前属性状态
        print(allowHTTP2_class)
        if "is-checked" not in mirror_client_versions_class:    #只有 当前状态为关时,才可以操作版本大小。
            min_version = self._get_value_from_data(data, key="min_client_version", data_index=data_index)
            max_version = self._get_value_from_data(data, key="max_client_version", data_index=data_index)
            print(min_version)
            print(max_version)
            version_index_list = ['sslv3.0', 'tlsv1.0', 'tlsv1.1', 'tlsv1.2', 'tlsv1.3']
            if min_version != no_modify:    #编辑时不修改,则不用操作
                self.driver.find_element(By.XPATH, sslDecryptionProfiles_input_minVersion_posXpath).click()
                element_pos_min_drop_down_item = sslDecryptionProfiles_dropDown_minVersion_posXpath.format(replaceIndex=version_index_list.index(min_version))   #组定位
                self.driver.find_element(By.XPATH, element_pos_min_drop_down_item).click()
                # allow HTTP/2打开时,校验Min version
                if "is-checked" in allowHTTP2_class and (min_version not in ["tlsv1.2", "tlsv1.3"]):
                    assert self.driver.element_isExist(By.XPATH, "//p[@class='el-message__content']")
                    error_content = self.driver.find_element(By.XPATH, "//p[@class='el-message__content']").text.strip()
                    # print("error_content=", error_content)
                    pytest_check.equal(error_content, "HTTP/2 MUST use TLS version 1.2 or higher.", msg="所在行数{}".format(inspect.currentframe().f_lineno))
            time.sleep(2)
            if max_version != no_modify:     #编辑时不修改,则不用操作
                self.driver.find_element(By.XPATH, sslDecryptionProfiles_input_maxVersion_posXpath).click()
                element_pos_max_drop_down_item = sslDecryptionProfiles_dropDown_maxVersion_posXpath.format(replaceIndex=version_index_list.index(max_version))   #组定位
                self.driver.find_element(By.XPATH, element_pos_max_drop_down_item).click()
                # allow HTTP/2打开时,校验Max version
                if "is-checked"  in allowHTTP2_class and (min_version not in ["tlsv1.2", "tlsv1.3"]):
                    assert self.driver.element_isExist(By.XPATH, "//p[@class='el-message__content']")
                    error_content = self.driver.find_element(By.XPATH, "//p[@class='el-message__content']").text.strip()
                    # print("error_content=", error_content)
                    pytest_check.equal(error_content, "HTTP/2 MUST use TLS version 1.2 or higher.", msg="所在行数{}".format(inspect.currentframe().f_lineno))
                    time.sleep(2)

    def _get_value_from_data(self, data: {}, key="", data_index=0):
        """
        从data数据中,根据key提取值
        :param data:
        :param key:
        :param data_index: 0 -1
        :return:
        """
        try:
            switch_value: str = data[key].split("->")[data_index].strip().lower()    #用例数据
        except Exception as e:
            print(e)
        return switch_value

    def _operate_switch(self, data: {}, data_index=0, no_modify="不修改", switch_name="", element_position=""):
        """
        页面中,开关状态操作。
        :param data:
        :param data_index: 0 -1来自上层
        :param no_modify:"不修改" 来自上次调用
        :param operation_type: create modify两个状态,
        :param switch_name: 数据中开关名称
        :param elementPosition: 开关的定位
        :return:
        """
        #解析输入data数据的数据
        switch_value: str = self._get_value_from_data(data, key=switch_name, data_index=data_index)     #提取数据
        if switch_value != no_modify:            #编辑时,有不修改则不用执行
            #先获取当前页面中开关状态   include_root_current_class : class="el-switch is-checked"   有is-checked当前状态为开,没有is-chedked当前状态为关
            swith_current_class = self.driver.find_element(By.XPATH, element_position).get_attribute("class")
            if "on" == switch_value:    #数据中为开
                if "is-checked" in swith_current_class:   #页面当前为开,不用点击开关
                    pass
                else:                                            #页面当前为关,需要点击开关
                    self.driver.find_element(By.XPATH, element_position).click()
            else:                     #用例输入为关
                if "is-checked" in swith_current_class:     #页面当前为开,需要点击开关
                    self.driver.find_element(By.XPATH, element_position).click()
                else:                                            #页面当前为关,不用点击开关
                    pass

    @screenshot_on_failure
    def _query(self, data: {}, vsys_name_2="", require_assertion=0, **kwargs):
        """
        查询函数,根据输入的类型查询
        :param require_assertion: =0默认情况不需要断言,=1为创建后使用的断言预期,=2为编辑修改后使用的断言预期
        :param kwargs: 例如 :可以查询使用的关键字,ID=None,Name=None,
        :return:
        """
        #打开该列表
        self._goto_subProfilePage(vsys_name_2=vsys_name_2)
        #first_row查询到的第一行内容。map_header_className为需要使用的到字典,用来提取第一行的结果。
        result = self.profiles_po.query(listPage_profileSearch_sslDecryptionProfiles_selectLabel_posId, listPage_profileSearch_sslDecryptionProfiles_dropDown_item_posXpath,
                                listPage_profileSearch_sslDecryptionProfiles_input_itemContent_posXpath, listPage_profileSearch_sslDecryptionProfiles_buttonSearch_posId,
                                listPage_profilTable_sslDecryptionProfiles_tableTbody_posXpath, listPage_profilTable_sslDecryptionProfiles_tableHeader_posXpath, **kwargs)
        if result == [0, 0]:
            return 0
        else:
            first_row, map_header_className = result
        #第一行的勾选定位,给修改、删除使用
        self.first_row_checkBox_element = first_row.find_element(By.XPATH, "//span[@class='el-checkbox__input']")
        self.first_row_ID_content = first_row.find_element(By.XPATH, "//div[@class='table-status-item-id']/span").text.strip()
        #print(map_header_className)
        # 需要提取id、name、type、Certificate Checks、Fail Action、Dynamic Bypass、Allow HTTP/2信息
        first_row_id_content = first_row.find_element(By.XPATH, "//div[@class='table-status-item-id']//span").text.strip()
        first_row_Name_class = map_header_className["Name"]
        first_row_Name_content = first_row.find_element(By.XPATH, f"//td[contains(@class, '{first_row_Name_class}')]//span").text.strip()
        #first_row_VsysID_class = map_header_className["Vsys ID"]
        #first_row_VsysID_content = first_row.find_element(By.XPATH, f"//td[contains(@class, '{first_row_VsysID_class}')]//span").text.strip()
        first_row_Certificate_Checks_class = map_header_className["Certificate Checks"]
        first_row_Certificate_Checks_content = first_row.find_element(By.XPATH, f"//td[contains(@class, '{first_row_Certificate_Checks_class}')]//span").text
        first_row_Fail_Action_class = map_header_className["Fail Action"]
        first_row_Fail_Action_content = first_row.find_element(By.XPATH, f"//td[contains(@class, '{first_row_Fail_Action_class}')]//span").text
        first_row_Dynamic_Bypass_class = map_header_className["Dynamic Bypass"]
        first_row_Dynamic_Bypass_content = first_row.find_element(By.XPATH, f"//td[contains(@class, '{first_row_Dynamic_Bypass_class}')]//span").text
        first_row_Allow_HTTP2_class = map_header_className["Allow HTTP/2"]
        first_row_Allow_HTTP2_content = first_row.find_element(By.XPATH, f"//td[contains(@class, '{first_row_Allow_HTTP2_class}')]//span").text

        # print(first_row_id_content, first_row_Name_content, first_row_Certificate_Checks_content, first_row_Fail_Action_content, first_row_Dynamic_Bypass_content, first_row_Allow_HTTP2_content)
        search_dict = {"ID": first_row_id_content, "Name": first_row_Name_content, "Certificate Checks": first_row_Certificate_Checks_content,
                       "Fail Action": first_row_Fail_Action_content, "Dynamic Bypass": first_row_Dynamic_Bypass_content, "Allow HTTP/2": first_row_Allow_HTTP2_content}
        print(search_dict)
        #不同操作后的断言,创建后、修改后、无断言
        if require_assertion == 1:  #直接创建后,使用的断言
            pytest_check.equal(first_row_Name_content, self.random_name, msg="所在行数{}".format(inspect.currentframe().f_lineno))
            self_signed = self._get_value_from_data(data, key="self_signed", data_index=0)
            common_name = self._get_value_from_data(data, key="common_name", data_index=0)
            fail_action = self._get_value_from_data(data, key="fail_action", data_index=0)
            allow_HTTP2 = self._get_value_from_data(data, key="fail_action", data_index=0)
            certificate_pinning = self._get_value_from_data(data, key="certificate_pinning", data_index=0)
            if self_signed == "on":
                pytest_check.is_in("Self-signed", first_row_Certificate_Checks_content, msg="所在行数{}".format(inspect.currentframe().f_lineno))
            if common_name == "on":
                pytest_check.is_in("Common Name", first_row_Certificate_Checks_content, msg="所在行数{}".format(inspect.currentframe().f_lineno))
            if fail_action == "pass-through":
                pytest_check.is_in("Pass-through", first_row_Fail_Action_content, msg="所在行数{}".format(inspect.currentframe().f_lineno))
            elif fail_action == "fail-close":
                pytest_check.is_in("Fail-close", first_row_Fail_Action_content, msg="所在行数{}".format(inspect.currentframe().f_lineno))
            if certificate_pinning == "on":
                pytest_check.is_in("Certificate Pinning", first_row_Dynamic_Bypass_content, msg="所在行数{}".format(inspect.currentframe().f_lineno))
            if allow_HTTP2 == "on":
                pytest_check.is_in("Enabled", first_row_Allow_HTTP2_content, msg="所在行数{}".format(inspect.currentframe().f_lineno))
        elif require_assertion == 2 and data["model"].strip().lower() == "modify":   #修改数据后,使用的断言
            pytest_check.equal(first_row_Name_content, self.random_name, msg="所在行数{}".format(inspect.currentframe().f_lineno))
            self_signed = self._get_value_from_data(data, key="self_signed", data_index=-1)
            common_name = self._get_value_from_data(data, key="common_name", data_index=-1)
            fail_action = self._get_value_from_data(data, key="fail_action", data_index=-1)
            allow_HTTP2 = self._get_value_from_data(data, key="fail_action", data_index=-1)
            certificate_pinning = self._get_value_from_data(data, key="certificate_pinning", data_index=-1)
            if self_signed == "on":
                pytest_check.is_in("Self-signed", first_row_Certificate_Checks_content, msg="所在行数{}".format(inspect.currentframe().f_lineno))
            if common_name == "on":
                pytest_check.is_in("Common Name", first_row_Certificate_Checks_content, msg="所在行数{}".format(inspect.currentframe().f_lineno))
            if fail_action == "pass-through":
                pytest_check.is_in("Pass-through", first_row_Fail_Action_content, msg="所在行数{}".format(inspect.currentframe().f_lineno))
            elif fail_action == "fail-close":
                pytest_check.is_in("Fail-close", first_row_Fail_Action_content, msg="所在行数{}".format(inspect.currentframe().f_lineno))
            if certificate_pinning == "on":
                pytest_check.is_in("Certificate Pinning", first_row_Dynamic_Bypass_content, msg="所在行数{}".format(inspect.currentframe().f_lineno))
            if allow_HTTP2 == "on":
                pytest_check.is_in("Enabled", first_row_Allow_HTTP2_content, msg="所在行数{}".format(inspect.currentframe().f_lineno))
        else:  #不适用断言
            pass
        #强制点击清空查询按钮
        element_clear = self.driver.find_element(By.ID, listPage_profileSearch_sslDecryptionProfiles_buttonClear_posId)
        self.driver.execute_script("arguments[0].click()", element_clear)  # 强制点击
        return search_dict

    @screenshot_on_failure
    def _modify(self, data: {},f_name=0):
        """
        修改数据,使用方法
        :param data:
        :return:
        """
        if data["model"].strip().lower() == "create":    #如果是create参数用例,则不用执行修改方法
            return 0
        #点击勾选第一行选择框
        self.first_row_checkBox_element.click()     #变量来自查询函数
        self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_editButton_posId).click()
        if f_name == 0:
            # 修改name
            new_Name = "(修改后)"
            self.driver.find_element(By.ID, sslDecryptionProfiles_input_Name_posId).send_keys(new_Name)
            self.random_name = self.random_name + new_Name
        #解析修改数据
        self._operate_page(data, operation_type="edit")
        #点击ok
        self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_oK_posCss).click()
        if self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_warningSaveYes_posCss).is_displayed():
            self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_warningSaveYes_posCss).click()

    @screenshot_on_failure
    def _del(self, del_model=0):
        """
        默认删除查询到的第一个结果
        :return:
        """
        #点击勾选第一行选择框
        if del_model == 0:
            #点击勾选第一行选择框
            self.first_row_checkBox_element.click()     #变量来自查询函数
        elif del_model == 1:  # 勾选可以删除的选项,并删除;没有锁、没有被引用的对象
            rows = self.driver.find_element(By.XPATH, listPage_profilTable_dnsRecords_tableTbody_posXpath).find_elements(By.XPATH, "./tr")
            if len(rows) == 0:   # 没有数据,直接返回
                return
            else:
                del_result = self.profiles_po.select_lock_and_referenceCount(rows)
                if del_result == 1:   # 1表示没有删除对象,直接返回
                    return 0
        #调用profiles的功能删除方法
        self.profiles_po.delete(listPage_profile_sslDecryptionProfiles_delButton_posId, listPage_dialogTips_sslDecryptionProfiles_button_yes_posCss,
                                listPage_dialogTips_sslDecryptionProfiles_button_no_posCss)

    def _column_setting(self, column: (), column_flags=0):
        """
        列设置函数,
        column_flags: 0---保持当前状态   1---仅显示默认列   2---显示所有列   3---显示自定义列
        :param column_flags:
        :param kwargs:
        :return:
        """
        # 打开该列表
        self._goto_subProfilePage()
        profiles = "Profile_Decryption_Profile"
        column_click = column[2:]
        current_column = self.profiles_po.column_setting(mainPage_profileColumn_columnSetting_posId,
                                                         listPage_profileColumn_sslDecryptionProfiles_button_columnAll_posXpath,
                                                         listPage_profileColumn_sslDecryptionProfiles_button_cancel_posId,
                                                         listPage_profileColumn_sslDecryptionProfiles_button_ok_posId, profiles,
                                                         column_flags, column_click)
        pytest_check.equal(current_column, column, msg="所在行数{}".format(inspect.currentframe().f_lineno))

    def _turn_pages(self, pages):
        """
                翻页
                pages:当前模块页数;如果页数>8,则有快速翻页功能(页面翻至第5页,显示左快速翻页按钮;当前页为左/右第4页时,不显示快速翻页按钮)
                :param profiles:
                :param pages:
                :return:
                """
        self._goto_subProfilePage()
        self.profiles_po.turn_pages("Profile_Decryption_Profile", pages)

    def _language_change(self, language):
        """
        语言切换函数
        language: 0---english; 1---chinese; 2---russian
        :param language:
        :return:
        """
        self._goto_subProfilePage()
        header_content = self.profiles_po.language_change(mainPage_language_change_posXpath,
                                                          mainPage_language_chinese_posXpath,
                                                          mainPage_language_russian_posXpath,
                                                          mainPage_language_english_posXpath, language)
        # 断言
        time.sleep(2)
        if language == 0:
            header_english = ["ID", "Vsys ID", "Name", "Certificate Checks", "Fail Action", "Dynamic Bypass", "Protocol Version", "Allow HTTP/2", "Reference Count", "Modified Time", "Last Modified By"]
            assert set(header_content).issubset(set(header_english))
        if language == 1:
            header_chinese = ["ID", "虚拟系统 ID", "名称", "证书验证", "失败行为", "动态放行", "协议版本", "允许 HTTP/2", "引用计数", "操作时间", "最后一次修改者"]
            assert set(header_content).issubset(set(header_chinese))
        if language == 2:
            header_russian = ["ID", "Vsys ID", "Имя", "Проверка Сертификата", "Действие Ошибки", "Динамический Байпас", "Версия Протокола", "Поддержка HTTP/2", "Подсчет Ссылок",  "Время Изменения", "Последний Раз Редактирован"]
            assert set(header_content).issubset(set(header_russian))

    def _vsys_case(self, data, c_vsys, c_type, c_supervisor, f_vsys, f_type, f_supervisor="None"):
        name = self._create(data, f_vsys)
        time.sleep(0.5)
        self._query(data, f_vsys, require_assertion=1, Name=name)  # 本vsys下查询
        time.sleep(0.5)
        result = self._query(data, c_vsys, require_assertion=1, Name=name)  # 到其他vsys下查询
        time.sleep(0.5)
        self._vsys_check(result, c_vsys, c_type, c_supervisor, f_vsys, f_type, f_supervisor)
        # 删除创建的数据
        time.sleep(0.5)
        self._query(data, f_vsys, require_assertion=1, Name=name)
        self._del()
        time.sleep(1)

    def _vsys_check(self, result, c_vsys, c_type, c_supervisor, f_vsys, f_type, f_supervisor):
        if c_type == f_type:  # 平级vsys不可见 T1 T2 或M1 M2(M1 M2无隶属关系)
            pytest_check.equal(result, 0, msg="所在行数{}".format(inspect.currentframe().f_lineno))
        else:
            if c_type == "Mvsys" and f_type == "Tvsys":  # Mvsys查看下级Tvsys数据
                if c_supervisor == "open":  # Mvsys开启监督模式,可查看下级Tvsys数据
                    self.first_row_checkBox_element.click()  # 变量来自查询函数
                    self.profiles_po.data_limit(listPage_profile_sslDecryptionProfiles_editButton_posId,
                                                listPage_profile_sslDecryptionProfiles_delButton_posId)
                elif c_supervisor == "close":  # Mvsys关闭监督模式,不可查看下级Tvsys数据
                    pytest_check.equal(result, 0, msg="所在行数{}".format(inspect.currentframe().f_lineno))
            elif c_type == "Tvsys" and f_type == "Mvsys":  # Tvsys查看Mvsys数据,不可查
                pytest_check.equal(result, 0, msg="所在行数{}".format(inspect.currentframe().f_lineno))

    @screenshot_on_failure
    def _audit_log(self, operation):
        """
        operation: Add---create; Update---modify
        :param operation:
        :return:
        """
        self.first_row_checkBox_element.click()
        self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_editButton_posId).click()
        time.sleep(2)
        self.driver.find_element(By.XPATH, "//div[@class='audit_log']/span").click()
        # 第一条记录勾选框
        self.driver.find_element(By.XPATH, "//tr[1]/td/div/label/span").click()
        # 点击Compare
        btn_compare = self.driver.find_element(By.ID, "test-compare-_AuditLogs_InfoRightProfile_VPanel_VEditPanel_Decryption_Profile_add_Home_App_anonymousComponent")
        self.driver.execute_script("arguments[0].click()", btn_compare)  # 强制点击
        time.sleep(0.5)
        # 获取 operation content
        current_operation = self.driver.find_element(By.XPATH, "//div[@class='compare-code-title']//div[3]/div[2]").text.strip()
        pytest_check.equal(current_operation, operation, msg="所在行数{}".format(inspect.currentframe().f_lineno))
        self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_cancel_posCss).click()

    def _policy_create(self, profile_name):
        # 进入Intercept列表页
        self._goto_vsysPage()
        self.driver.find_element(By.ID, mainPage_firstLevelMenu_Policy_posId).click()
        self.driver.find_element(By.ID, mainPage_secondLevelMenu_Proxy_intercept_posId).click()
        # 创建 rule
        policy_name = self.profiles_po.policy_create("Intercept", profile_name, listPage_intercept_create_button_posId, intercept_create_Name_input_frame_PosXpath,
                                intercept_create_action_intercept_label_posId, intercept_create_add_IPAddress_button_click_posXpath, intercept_button_oK_posId, intercept_button_cancel_posId,
                                intercept_button_warningSaveYes_posCss, "ssl", intercept_create_add_application_button_click_posXpath, "",
                                "SSL_Decryption_Profile", intercept_ssl_decryptionProfile_dropDown_posXpath, intercept_ssl_decryptionProfile_search_posXpath)
        return policy_name

    def _policy_query(self, **kwargs):
        # 打开该列表
        self._goto_vsysPage()
        self.driver.find_element(By.ID, mainPage_firstLevelMenu_Policy_posId).click()
        self.driver.find_element(By.ID, mainPage_secondLevelMenu_Proxy_intercept_posId).click()
        # first_row查询到的第一行内容。map_header_className为需要使用的到字典,用来提取第一行的结果。
        result = self.profiles_po.query(listPage_interceptSearch_selectLabel_posId, listPage_interceptSearch_dropDown_item_posXpath,
                                listPage_interceptSearch_input_itemContent_posXpath, listPage_interceptSearch_buttonSearch_posId,
                                listPage_interceptTable_tableTbody_posXpath, listPage_interceptTable_tableHeader_posXpath, **kwargs)
        if result == [0, 0]:
            print("no data")
        else:
            first_row, map_header_className = result
            # 第一行的勾选定位,给修改、删除使用
            self.first_row_checkBox_element = first_row.find_element(By.XPATH, "//span[@class='el-checkbox__input']")

    def _policy_del(self):
        """
        默认删除查询到的第一个结果
        :return:
        """
        # 点击勾选第一行选择框
        self.first_row_checkBox_element.click()  # 变量来自查询函数
        # 调用profiles的功能删除方法
        self.profiles_po.delete(listPage_intercept_delete_button_posId,
                                listPage_dialogTips_intercept_button_yes_posCss,
                                listPage_dialogTips_intercept_button_no_posCss)

    def _referenceCount_view(self, **kwargs):
        self._goto_subProfilePage()
        first_row, map_header_className = \
            self.profiles_po.query(listPage_profileSearch_sslDecryptionProfiles_selectLabel_posId,
                                   listPage_profileSearch_sslDecryptionProfiles_dropDown_item_posXpath,
                                   listPage_profileSearch_sslDecryptionProfiles_input_itemContent_posXpath,
                                   listPage_profileSearch_sslDecryptionProfiles_buttonSearch_posId,
                                   listPage_profilTable_sslDecryptionProfiles_tableTbody_posXpath,
                                   listPage_profilTable_sslDecryptionProfiles_tableHeader_posXpath, **kwargs)
        first_row_checkBox_element = first_row.find_element(By.XPATH, "//span[@class='el-checkbox__input']")
        first_row_referenceCount_class = map_header_className["Reference Count"]
        # print("first_row_referenceCount_class=", first_row_referenceCount_class)
        first_row_checkBox_element.click()
        if first_row.find_element(By.XPATH,
                                  f"//td[contains(@class, '{first_row_referenceCount_class}')]/div").get_attribute("value") != "0":
            print("数据被引用")
            # 校验该条数据是否可删除
            text_del = self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_delButton_posId).get_attribute("class")
            disabled_class = text_del.split(" ")[-1].strip()
            pytest_check.equal(disabled_class, "is-disabled", msg="所在行数{}".format(inspect.currentframe().f_lineno))
            # 校验是否弹出侧滑框
            first_row.find_element(By.ID, "ReferenceData-_Profile_Decryption_Profile_Home_App_anonymousComponent").click()   #点击引用计数
            pytest_check.equal(self.driver.element_isExist(By.XPATH, "//div[@class='LocalationDraswer lstsub policy-right-show-edit']"),
                               True, msg="所在行数{}".format(inspect.currentframe().f_lineno))
            self.driver.find_element(By.XPATH, "//div[@class='box-content']/div/div[1]").click()

    def _buildin_check(self, vsys_name="UIAutoTestVsys", vsys_type="Tvsys", vsys_id="10"):
        self._goto_subProfilePage(vsys_name_2=vsys_name)
        self.driver.find_element(By.ID, listPage_profileSearch_sslDecryptionProfiles_selectLabel_posId).click()
        self.driver.find_element(By.ID, "2-_FilteredSearch_ElRow_Profile_Decryption_Profile_Home_App_anonymousComponent").click()
        self.driver.find_element(By.XPATH, "//div[contains(@class,'ListItem')]//span[text()='Name']/ancestor::div[contains(@class,'ListItem')]//input").send_keys("decryption-default")
        self.driver.find_element(By.ID, listPage_profileSearch_sslDecryptionProfiles_buttonSearch_posId).click()
        self.driver.execute_script("arguments[0].click()", self.driver.find_element(By.ID, listPage_profileSearch_sslDecryptionProfiles_buttonSearch_posId)) #强制点击
        element_tbody = self.driver.find_element(By.XPATH,
                                                 listPage_profilTable_sslDecryptionProfiles_tableTbody_posXpath)  # 找到所有的行,table的body
        element_header = self.driver.find_element(By.XPATH,
                                                  listPage_profilTable_sslDecryptionProfiles_tableHeader_posXpath)  # 查询table的header
        # 获取table header的text、th.class
        # headers = element_header.find_elements(By.XPATH, "th")  # table header
        rows = element_tbody.find_elements(By.XPATH, "tr")  # table body
        if len(rows) == 0:
            print("没有查询到数据:decryption-default")
        if vsys_type == "Tvsys":
            assert len(rows) == 1
        # 从查询的结果中,取出需要断言的值
        for i in range(len(rows)):
            # print("test=", self.driver.find_element(By.XPATH, f"//tr[{i+1}]//span[@class='el-checkbox__input']"))
            self.driver.find_element(By.XPATH, f"//tr[{i+1}]//span[@class='el-checkbox__input']").click()  # 勾选当前数据的复选框
            #data_vsysid = self.driver.find_element(By.XPATH, f"//div[contains(@class,'ly-table1')]//tbody/tr[{i+1}]/td[2]/div[@class='cell']//span").text.strip()
            # print("data_vsysid=", data_vsysid)
            # 校验当前数据是否为只能查看
            text_view = self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_editButton_posId).text.strip()
            class_view = self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_editButton_posId).get_attribute("class")
            # print("text_view=", text_view)
            if i == 0:
                pytest_check.equal(text_view, "Edit", msg="所在行数{}".format(inspect.currentframe().f_lineno))
                #pytest_check.equal(data_vsysid, vsys_id, msg="所在行数{}".format(inspect.currentframe().f_lineno))
                assert class_view.split(" ")[-1].strip() != "is-disabled"
            else:
                pytest_check.equal(text_view, "View", msg="所在行数{}".format(inspect.currentframe().f_lineno))
                assert class_view.split(" ")[-1].strip() != "is-disabled"
            # 校验删除按钮是否置灰
            text_del = self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_delButton_posId).get_attribute("class")
            # print("text_del=", text_del)
            disabled_class = text_del.split(" ")[-1].strip()
            # print("disabled_class=", disabled_class)
            pytest_check.equal(disabled_class, "is-disabled", msg="所在行数{}".format(inspect.currentframe().f_lineno))
            # 校验是否带锁
            if i != 0:
                isExist_lock = self.driver.element_isExist(By.XPATH, "//i[@class='iconfont icon-lock']")
                assert isExist_lock
            # 校验是否有内置标识
            isExist_builtin = self.driver.element_isExist(By.CSS_SELECTOR, ".icon > use")
            print("test=", isExist_builtin)
            assert isExist_builtin
            print("test=", self.driver.find_element(By.XPATH, f"//tr[{i+1}]//span[contains(@class,'el-checkbox__input')]"))
            self.driver.find_element(By.XPATH, f"//tr[{i+1}]//span[contains(@class,'el-checkbox__input')]").click()  # 取消勾选当前数据的复选框
            time.sleep(3)

    @screenshot_on_failure
    def listPageBottom_allSelect(self):
        # 跳转到列表页
        self._goto_subProfilePage()    #跳转页面
        self.profiles_po.check_checkBoxClass_by_buttonAll()

    @screenshot_on_failure
    def check_createAndEditPageElement(self, data):
        # 检验create 页面元素
        self._goto_subProfilePage()    #跳转页面
        #点击create
        self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_createButton_posId).click()
        #在create 页面校验元素
        create_page_header_except = "Create Decryption Profile"
        create_page_headr_actual = self.driver.find_element(By.XPATH, sslDecryptionProfiles_headerTitle_posXpath).text.strip()
        print("开始校验create页面元素...")
        pytest_check.equal(create_page_header_except, create_page_headr_actual, msg="所在行数{}".format(inspect.currentframe().f_lineno))
        # 点击 cancel 按钮
        self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_cancel_posCss).click()
        # 检验edit 页面元素
        tmp_name = self._create(data)
        time.sleep(3)
        self._query(data, require_assertion=0, Name=tmp_name)    #创建后查询
        if data["model"].strip().lower() == "create":    #如果是create参数用例,则不用执行修改方法
            return 0
        #点击勾选第一行选择框
        self.first_row_checkBox_element.click()     #变量来自查询函数
        self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_editButton_posId).click()   #打开edit页面
        print("开始校验edit页面元素...")
        edit_page_header_except = "Edit Decryption Profile"
        edit_page_headr_actual = self.driver.find_element(By.XPATH, sslDecryptionProfiles_headerTitle_posXpath).text.strip()
        pytest_check.equal(edit_page_header_except, edit_page_headr_actual, msg="所在行数{}".format(inspect.currentframe().f_lineno))
        # 点击 cancel 按钮
        self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_cancel_posCss).click()
        self._query(data, require_assertion=0, Name=tmp_name)
        self._del()    #删除数据

    @screenshot_on_failure
    def check_link_case(self, data, link_list_dict):
        # link简单link校验测试
        """
        :param data: link_list_dict=[{"link_dst_cluster": "42.49-User4Link", "link_dst_vsys":"Vsys2test", "url": "http://192.168.42.49/#/login","username": "admin","passwd": "admin"}])
        :param link_list_dict:
        :return:
        """
        self._goto_subProfilePage()
        tmp_name = self._create(data)
        time.sleep(3)
        self._query(data, require_assertion=0, Name=tmp_name)
        # 勾选第一行
        self.first_row_checkBox_element.click()
        # 调用公共的link创建逻辑
        self.profiles_po.linkdata(link_list_dict, listPage_profile_sslDecryptionProfiles_linkButton_posId, listPage_linkTips_sslDecryptionProfiles_button_save_posXpath,
                                  listPage_linkTips_sslDecryptionProfiles_button_add_posXpath, listPage_linkTips_sslDecryptionProfiles_button_OK_posXpath)
        # 删除数据
        self._query(data, require_assertion=0, Name=tmp_name)
        self._del(del_model=1)    #删除数据
        time.sleep(3)
        # 删除其它目标link数据逻辑
        self._del_linkDstData(data, tmp_name, link_list_dict)

    def _del_linkDstData(self, data, tmp_name, link_list_dict):
        """
        删除目标link数据
        :param data:
        :param tmp_name:
        :param link_list_dict:
        :return:
        """
        loginout = LogInOut(self.driver)
        loginout.logout()
        time.sleep(1)
        for link_index in range(len(link_list_dict)):
            loginout.login_other(url=link_list_dict[link_index]["url"], username=link_list_dict[link_index]["username"],
                                 passwd=link_list_dict[link_index]["passwd"])
            self._query(data, vsys_name_2=link_list_dict[link_index]["link_dst_vsys"], require_assertion=0, Name=tmp_name)
            self._del(del_model=1)    #删除数据
            time.sleep(3)
            # 退出账号
            loginout.logout()
            time.sleep(1)
        # 再次登录源tsg,测试退出使用
        loginout.login()

    @screenshot_on_failure
    def chk_lnk_mod_case(self, data, link_list_dict):
        # link 源数据修改测试
        """
        :param data: link_list_dict=[{"link_dst_cluster": "42.49-User4Link", "link_dst_vsys":"Vsys2test", "url": "http://192.168.42.49/#/login","username": "admin","passwd": "admin"}])
        :param link_list_dict:
        :return:
        """
        try:
            tmp_name = self._create(data)
            time.sleep(3)
            search_dict = self._query(data, require_assertion=0, Name=tmp_name)
            # 勾选第一行
            self.first_row_checkBox_element.click()
            # 调用公共的link创建逻辑
            Des_ID_list, Request_ID, Sou_ID_list = self.profiles_po.linkdata(link_list_dict,
                                                                             listPage_profile_sslDecryptionProfiles_linkButton_posId,
                                                                             listPage_linkTips_sslDecryptionProfiles_button_save_posXpath,
                                                                             listPage_linkTips_sslDecryptionProfiles_button_add_posXpath,
                                                                             listPage_linkTips_sslDecryptionProfiles_button_OK_posXpath)

            self._query(data, require_assertion=1, ID=search_dict["ID"])
            # 点击勾选第一行选择框
            self.first_row_checkBox_element.click()  # 变量来自查询函数
            time.sleep(1)
            self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_editButton_posId).click()
            # save data
            src_val_dict = self._get_value_dict(data)
            print("src_val_dict ======== ", src_val_dict)
            loginout = LogInOut(self.driver)
            loginout.logout()
            time.sleep(2)
            for link_index in range(len(link_list_dict)):
                loginout.login_other(url=link_list_dict[link_index]["url"], username=link_list_dict[link_index]["username"],
                                     passwd=link_list_dict[link_index]["passwd"])
                profile_public = ProfilesPublicOperations(self.driver)
                profile_public.change_vsys(vsys_name=link_list_dict[link_index]["link_dst_vsys"])
                # 获取sync后的值
                self._query(data, vsys_name_2=link_list_dict[link_index]["link_dst_vsys"], require_assertion=0, ID=Des_ID_list[0])
                # 点击勾选第一行选择框
                self.first_row_checkBox_element.click()  # 变量来自查询函数
                time.sleep(1)
                self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_editButton_posId).click()

                des_val_dict = self._get_value_dict(data)
                print("des_val_dict ======== ", des_val_dict)
                pytest_check.equal(src_val_dict, des_val_dict,
                                   msg="所在行数{}".format(inspect.currentframe().f_lineno))

            # 切换到目的源 cluster
            self.profiles_po.change_sou_vsys()
            # update data
            self._query(data, require_assertion=1, ID=search_dict["ID"])
            self._modify(data)
            self._query(data, require_assertion=2, ID=search_dict["ID"])
            # 点击勾选第一行选择框
            self.first_row_checkBox_element.click()  # 变量来自查询函数
            time.sleep(1)
            self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_editButton_posId).click()
            # save data
            sou_value_dict = self._get_value_dict(data)
            print("sou_value_dict ======== ", sou_value_dict)
            time.sleep(1)
            # click sync
            Request_ID = self.profiles_po.click_pol_lnk_sync(Request_ID)
            time.sleep(3)
            #
            Request_ID, update_one_value_dict, update_two_value_dict = self._mod_des_chk_syc(Des_ID_list, Request_ID,
                                                                                            link_list_dict, data)

            # 判断是否一致
            self.profiles_po.dicts_are_equal(sou_value_dict, update_one_value_dict, update_two_value_dict)
        except Exception as e:
            assert e
        finally:
            self._just_goto_ssl_decryption_page()
            self._delete_des(Des_ID_list, data)  # 删除数据
            # 删除policy links记录
            self.profiles_po._del_policy_links(Request_ID)
            # 删除源vsys数据
            self._delete_sou(Sou_ID_list, data)

    @screenshot_on_failure
    def chk_lnk_butin_data_case(self, data, link_list_dict):
        # link 源数据修改测试
        """
        :param data: link_list_dict=[{"link_dst_cluster": "42.49-User4Link", "link_dst_vsys":"Vsys2test", "url": "http://192.168.42.49/#/login","username": "admin","passwd": "admin"}])
        :param link_list_dict:
        :return:
        """
        # jump page
        self._just_goto_ssl_decryption_page()
        # search butin data
        butin_elem = self.driver.find_elements(By.XPATH,
                                               "//tbody//*[contains(@class, 'svg-icon')]/ancestor::div[1]/following-sibling::div[1]/span")
        butin_elem_val = []
        for ele in butin_elem:
            ele_val = ele.text
            butin_elem_val.append(ele_val)
        print("butin_elem_val =============== ", butin_elem_val)
        # search element
        ran_ele = random.choice(butin_elem_val)
        self._query(data, require_assertion=0, ID=ran_ele)
        # 勾选第一行
        self.first_row_checkBox_element.click()
        self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_editButton_posId).click()
        # save src data
        rev_data = self._get_value_dict(data)
        print("rev_data ============ ", rev_data)
        try:
            self._query(data, require_assertion=0, ID=ran_ele)
            # 勾选第一行
            self.first_row_checkBox_element.click()
            # 调用公共的link创建逻辑
            Des_ID_list, Request_ID, Sou_ID_list = self.profiles_po.linkdata(link_list_dict,
                                                                             listPage_profile_sslDecryptionProfiles_linkButton_posId,
                                                                             listPage_linkTips_sslDecryptionProfiles_button_save_posXpath,
                                                                             listPage_linkTips_sslDecryptionProfiles_button_add_posXpath,
                                                                             listPage_linkTips_sslDecryptionProfiles_button_OK_posXpath)
            # 切换到目的源 cluster
            loginout = LogInOut(self.driver)
            loginout.logout()
            time.sleep(2)
            for link_index in range(len(link_list_dict)):
                loginout.login_other(url=link_list_dict[link_index]["url"], username=link_list_dict[link_index]["username"],
                                     passwd=link_list_dict[link_index]["passwd"])
                profile_public = ProfilesPublicOperations(self.driver)
                profile_public.change_vsys(vsys_name=link_list_dict[link_index]["link_dst_vsys"])
                self._query(data, vsys_name_2=link_list_dict[link_index]["link_dst_vsys"], require_assertion=0,
                            ID=Des_ID_list[0])
                # 点击勾选第一行选择框
                self.first_row_checkBox_element.click()  # 变量来自查询函数
                time.sleep(1)
                self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_editButton_posId).click()
                # save data
                des_val_dict = self._get_value_dict(data)
                print("des_val_dict ======== ", des_val_dict)
                pytest_check.equal(rev_data, des_val_dict,
                                   msg="所在行数{}".format(inspect.currentframe().f_lineno))
            #
            # # 切换到源 cluster
            self.profiles_po.change_sou_vsys()
            # update data
            self._query(data, require_assertion=0, ID=ran_ele)
            self._modify(data, f_name=1)
            self._query(data, require_assertion=0, ID=ran_ele)
            # 点击勾选第一行选择框
            self.first_row_checkBox_element.click()  # 变量来自查询函数
            time.sleep(1)
            self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_editButton_posId).click()
            # save data
            sou_value_dict = self._get_value_dict(data)
            print("sou_value_dict ======== ", sou_value_dict)
            time.sleep(1)
            # click sync
            Request_ID = self.profiles_po.click_pol_lnk_sync(Request_ID)
            time.sleep(3)
            #
            Request_ID, update_one_value_dict, update_two_value_dict = self.chk_des_del_lnk_data(Des_ID_list,
                                                                                                 Request_ID,
                                                                                                 link_list_dict, data, )
            # 删除policy links记录
            self.profiles_po._del_policy_links(Request_ID)
            # # 删除源vsys数据
            # self._delete_sou(Sou_ID_list, data)
            # 判断是否一致
            self.profiles_po.dicts_are_equal(sou_value_dict, update_one_value_dict, update_two_value_dict)
        except Exception as e:
            print(e)
        finally:
            print("recover sou data ============= please wait")
            self._rev_sou(data, rev_data, ran_ele)
            print("recover des data ============= please wait")
            self._rev_des(data, rev_data, ran_ele, link_list_dict)

    def _rev_sou(self, data, rev_data, ran_ele):
        loginout = LogInOut(self.driver)
        loginout.logout()
        time.sleep(1)
        loginout.login_other(url="http://192.168.44.72/#/login",
                             username="AUTO_UI_TEST_KG", passwd="kongweibin1")
        # 恢复数据
        profile_public = ProfilesPublicOperations(self.driver)
        profile_public.change_vsys(vsys_name="UIAutoTestVsys")
        self._just_goto_ssl_decryption_page()
        self._query(data, require_assertion=0, ID=ran_ele)
        self.first_row_checkBox_element.click()
        time.sleep(1)
        self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_editButton_posId).click()
        self._rev_data(rev_data)

    def _rev_des(self, data, rev_data, ran_ele, link_list_dict):
        loginout = LogInOut(self.driver)
        loginout.logout()
        time.sleep(1)
        for link_index in range(len(link_list_dict)):
            loginout.login_other(url=link_list_dict[link_index]["url"], username=link_list_dict[link_index]["username"],
                                 passwd=link_list_dict[link_index]["passwd"])
            profile_public = ProfilesPublicOperations(self.driver)
            profile_public.change_vsys(vsys_name=link_list_dict[link_index]["link_dst_vsys"])

            self._just_goto_ssl_decryption_page()
            self._query(data, vsys_name_2=link_list_dict[link_index]["link_dst_vsys"], require_assertion=0, ID=ran_ele)
            self.first_row_checkBox_element.click()
            time.sleep(1)
            self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_editButton_posId).click()
            self._rev_data(rev_data)


    def _rev_data(self, value_dict):
        '''
            {'common_name': 'true',
            'issuer': 'true',
            'self_signed': 'true',
            'expiry_date': 'true',
            'fail_action': 'Pass-through',
            'ev_certificate': None,
            'certificate_transparency': None,
            'mutual_authentication': 'true',
            'protocol_errors': 'true',
            'certificate_pinning': 'true',
            'certificate_not_installed': None,
            'mirror_client_versions': 'true',
            'allow_HTTP2': 'true'}
        '''
        self.driver.find_element(By.ID, sslDecryptionProfiles_input_Name_posId).clear()
        self.driver.find_element(By.ID, sslDecryptionProfiles_input_Name_posId).send_keys(value_dict['name'])
        self._operate_switch_rec(value_dict["common_name"],
                             sslDecryptionProfiles_switch_commonName_posXpath)

        self._operate_switch_rec(value_dict["issuer"],
                             sslDecryptionProfiles_switch_issuer_posXpath)
        self._operate_switch_rec(value_dict["self_signed"],
                             sslDecryptionProfiles_switch_selfSigned_posXpath)


        self._operate_switch_rec(value_dict["expiry_date"],
                             sslDecryptionProfiles_switch_expiryDate_posXpath)

        if "Pass-through" == value_dict["fail_action"]:  # 点击pass through
            self.driver.find_element(By.XPATH, sslDecryptionProfiles_radio_passThrough_posXpath).click()
        else:  # 点击fail close
            self.driver.find_element(By.XPATH, sslDecryptionProfiles_radio_failClose_posXpath).click()


        self._operate_switch_rec(value_dict["ev_certificate"],
                             sslDecryptionProfiles_switch_evCert_posXpath)

        self._operate_switch_rec(value_dict["certificate_transparency"],
                             sslDecryptionProfiles_switch_certificateTransparency_posXpath)

        self._operate_switch_rec(value_dict["mutual_authentication"],
                             sslDecryptionProfiles_switch_mutualAuthentication_posXpath)

        self._operate_switch_rec(value_dict["protocol_errors"],
                             sslDecryptionProfiles_switch_onProtocolErrors_posXpath)

        self._operate_switch_rec(value_dict["certificate_pinning"],
                             sslDecryptionProfiles_switch_certificatePinning_posXpath)

        self._operate_switch_rec(value_dict["certificate_not_installed"],
                             sslDecryptionProfiles_switch_certificateNotInstalled_posXpath)

        self._operate_switch_rec(value_dict["mirror_client_versions"],
                             sslDecryptionProfiles_switch_mirrorClientVersions_posXpath)

        if value_dict["mirror_client_versions"] == None:
            self.driver.find_element(By.XPATH,
                                     "//label[text()='Min Version']/following-sibling::div//input").send_keys(value_dict["min_client_version"])
            self.driver.find_element(By.XPATH,
                                     "//label[text()='Max Version']/following-sibling::div//input").send_keys(value_dict["max_client_version"])
        self._operate_switch_rec(value_dict["allow_HTTP2"],
                             sslDecryptionProfiles_switch_allowHTTP2_posXpath)
        self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_oK_posCss).click()
        if self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_warningSaveYes_posCss).is_displayed():
            self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_warningSaveYes_posCss).click()

    def _operate_switch_rec(self, switch_value="", element_position=""):
        """
        页面中,开关状态操作。
        :param data:
        :param data_index: 0 -1来自上层
        :param no_modify:"不修改" 来自上次调用
        :param operation_type: create modify两个状态,
        :param switch_name: 数据中开关名称
        :param elementPosition: 开关的定位
        :return:
        """
        print("switch_value ================ ", switch_value)
        #先获取当前页面中开关状态   include_root_current_class : class="el-switch is-checked"   有is-checked当前状态为开,没有is-chedked当前状态为关
        swith_current_class = self.driver.find_element(By.XPATH, element_position).get_attribute("class")
        if "true" == switch_value:    #数据中为开
            if "is-checked" in swith_current_class:   #页面当前为开,不用点击开关
                pass
            else:                                            #页面当前为关,需要点击开关
                self.driver.find_element(By.XPATH, element_position).click()
        else:                     #用例输入为关
            if "is-checked" in swith_current_class:     #页面当前为开,需要点击开关
                self.driver.find_element(By.XPATH, element_position).click()
            else:                                            #页面当前为关,不用点击开关
                pass

    @screenshot_on_failure
    def _mod_des_chk_syc(self, Des_ID_list, Request_ID, link_list_dict, data):
        loginout = LogInOut(self.driver)
        loginout.logout()
        time.sleep(2)
        for link_index in range(len(link_list_dict)):
            loginout.login_other(url=link_list_dict[link_index]["url"], username=link_list_dict[link_index]["username"],
                                 passwd=link_list_dict[link_index]["passwd"])
            profile_public = ProfilesPublicOperations(self.driver)
            profile_public.change_vsys(vsys_name=link_list_dict[link_index]["link_dst_vsys"])
            # 获取sync后的值
            self._query(data, vsys_name_2=link_list_dict[link_index]["link_dst_vsys"], require_assertion=0, ID=Des_ID_list[0])
            # 点击勾选第一行选择框
            self.first_row_checkBox_element.click()  # 变量来自查询函数
            time.sleep(1)
            self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_editButton_posId).click()

            update_one_value_dict = self._get_value_dict(data)
            # modify des data
            self._query(data, vsys_name_2=link_list_dict[link_index]["link_dst_vsys"], require_assertion=0, ID=Des_ID_list[0])
            self._modify(data={
                "ids": "创建ssl_decryption_profiles_fail_action_on再修改common_name_off22",
                "model": "modify",
                "common_name": "off->on",
                "issuer": "on->on",
                "self_signed": "off->on",
                "expiry_date": "on->on",
                "fail_action": "Pass-through->不修改",
                "ev_certificate": "on->off",
                "certificate_transparency": "off->不修改",
                "mutual_authentication": "on->不修改",
                "protocol_errors": "off->on",
                "certificate_pinning": "on->on",
                "certificate_not_installed": "on->off",
                "mirror_client_versions": "on->on",
                "allow_HTTP2": "off->on"
            }, f_name=1)
            # # 调用公用的sync点击逻辑
            Request_ID = self.profiles_po.click_pol_lnk_sync(Request_ID)

            loginout.login_other(url=link_list_dict[link_index]["url"],
                                 username=link_list_dict[link_index]["username"],
                                 passwd=link_list_dict[link_index]["passwd"])
            profile_public = ProfilesPublicOperations(self.driver)
            profile_public.change_vsys(vsys_name=link_list_dict[link_index]["link_dst_vsys"])
            # 再次获取sync后的值
            self._query(data, vsys_name_2=link_list_dict[link_index]["link_dst_vsys"], require_assertion=0, ID=Des_ID_list[0])
            # 点击勾选第一行选择框
            self.first_row_checkBox_element.click()  # 变量来自查询函数
            time.sleep(1)
            self.driver.find_element(By.ID, listPage_profile_sslDecryptionProfiles_editButton_posId).click()

            update_two_value_dict = self._get_value_dict(data)
            time.sleep(3)

        return Request_ID, update_one_value_dict, update_two_value_dict

    def _delete_sou(self, Sou_ID_list, data):
        loginout = LogInOut(self.driver)
        loginout.logout()
        time.sleep(1)
        loginout.login_other(url="http://192.168.44.72/#/login",
                             username="AUTO_UI_TEST_KG", passwd="kongweibin1")
        # 删除数据
        profile_public = ProfilesPublicOperations(self.driver)
        profile_public.change_vsys(vsys_name="UIAutoTestVsys")
        self._just_goto_ssl_decryption_page()
        self._delete_source(Sou_ID_list, data)  # 删除数据

    def _delete_des(self, Des_ID_list, data):
        self.driver.find_element(By.ID, 'select-label').click()
        self.driver.find_element(By.XPATH,
                                 "//li[starts-with(@id, '1-_FilteredSearch_ElRow_')]//span[normalize-space(text())='ID']").click()
        self.driver.find_element(By.XPATH, '//input[contains(@placeholder, "Support")]').send_keys(Des_ID_list[0])
        self.driver.find_element(By.ID, mainPage_profileSearch_buttonSearch_posId).click()
        time.sleep(1)
        self.driver.find_element(By.XPATH,
                                 "//div[@class='el-checkbox-group']//span[@class='el-checkbox__input']/span[@class='el-checkbox__inner']").click()
        # 确认删除
        self.driver.find_element(By.XPATH, "//p[normalize-space(text())='Delete']").click()
        self.driver.find_element(By.CSS_SELECTOR, listPage_dialogTips_sslDecryptionProfiles_button_yes_posCss).click()


    def _delete_source(self, Sou_ID_list, data):
        self.driver.find_element(By.ID, 'select-label').click()
        self.driver.find_element(By.XPATH,
                                 "//li[starts-with(@id, '1-_FilteredSearch_ElRow_')]//span[normalize-space(text())='ID']").click()
        self.driver.find_element(By.XPATH, '//input[contains(@placeholder, "Support")]').send_keys(Sou_ID_list[0])
        self.driver.find_element(By.ID, mainPage_profileSearch_buttonSearch_posId).click()
        time.sleep(1)
        self.driver.find_element(By.XPATH,
                                 "//div[@class='el-checkbox-group']//span[@class='el-checkbox__input']/span[@class='el-checkbox__inner']").click()
        # 确认删除
        self.driver.find_element(By.XPATH, "//p[normalize-space(text())='Delete']").click()
        self.driver.find_element(By.CSS_SELECTOR, listPage_dialogTips_sslDecryptionProfiles_button_yes_posCss).click()

    @screenshot_on_failure
    def _just_goto_ssl_decryption_page(self, vsys_name_2=""):
        # 菜单操作,定位到ssl_decryption_keyrings列表页
        # self.driver.find_element(By.CSS_SELECTOR, mainPage_navigationBar_logo_posCss).click()
        self.driver.find_element(By.ID, mainPage_firstLevelMenu_profiles_posId).click()
        element = self.driver.find_element(By.ID, mainPage_secondLevelMenu_sslDecryptionProfiles_posId)
        self.driver.execute_script("arguments[0].click()", element)  # 强制点击

    @screenshot_on_failure
    def _get_value_dict(self, data):
        '''
            "common_name": "off->on",
            "issuer": "off->on",
            "self_signed": "on->不修改",
            "expiry_date": "on->不修改",
            "fail_action": "Pass-through->不修改",
            "ev_certificate": "off->on",
            "certificate_transparency": "on->不修改",
            "mutual_authentication": "on->不修改",
            "protocol_errors": "on->不修改",
            "certificate_pinning": "off->on",
            "certificate_not_installed": "->on",
            "mirror_client_versions": "off->off",
            "min_client_version": "TLSv1.2->不修改",
            "max_client_version": "TLSv1.3->不修改",
            "allow_HTTP2": "on->off"
        '''
        value_dict = {}
        name = self.driver.find_element(By.ID, sslDecryptionProfiles_input_Name_posId).get_attribute("value")
        value_dict["name"] = name
        common_name = self.driver.find_element(By.XPATH, sslDecryptionProfiles_switch_commonName_posXpath).get_attribute("aria-checked")
        value_dict["common_name"] = common_name
        issuer = self.driver.find_element(By.XPATH, sslDecryptionProfiles_switch_issuer_posXpath).get_attribute("aria-checked")
        value_dict["issuer"] = issuer
        self_signed = self.driver.find_element(By.XPATH, sslDecryptionProfiles_switch_selfSigned_posXpath).get_attribute("aria-checked")
        value_dict["self_signed"] = self_signed
        expiry_date = self.driver.find_element(By.XPATH, sslDecryptionProfiles_switch_expiryDate_posXpath).get_attribute("aria-checked")
        value_dict["expiry_date"] = expiry_date
        fail_action = self.driver.find_element(By.XPATH, "//label[contains(@class, 'is-active')]").text
        value_dict["fail_action"] = fail_action
        ev_certificate = self.driver.find_element(By.XPATH, sslDecryptionProfiles_switch_evCert_posXpath).get_attribute("aria-checked")
        value_dict["ev_certificate"] = ev_certificate
        certificate_transparency = self.driver.find_element(By.XPATH, sslDecryptionProfiles_switch_certificateTransparency_posXpath).get_attribute("aria-checked")
        value_dict["certificate_transparency"] = certificate_transparency
        mutual_authentication = self.driver.find_element(By.XPATH, sslDecryptionProfiles_switch_mutualAuthentication_posXpath).get_attribute("aria-checked")
        value_dict["mutual_authentication"] = mutual_authentication
        protocol_errors = self.driver.find_element(By.XPATH, sslDecryptionProfiles_switch_onProtocolErrors_posXpath).get_attribute("aria-checked")
        value_dict["protocol_errors"] = protocol_errors
        certificate_pinning = self.driver.find_element(By.XPATH, sslDecryptionProfiles_switch_certificatePinning_posXpath).get_attribute("aria-checked")
        value_dict["certificate_pinning"] = certificate_pinning
        certificate_not_installed = self.driver.find_element(By.XPATH, sslDecryptionProfiles_switch_certificateNotInstalled_posXpath).get_attribute("aria-checked")
        value_dict["certificate_not_installed"] = certificate_not_installed
        mirror_client_versions = self.driver.find_element(By.XPATH, sslDecryptionProfiles_switch_mirrorClientVersions_posXpath).get_attribute("aria-checked")
        value_dict["mirror_client_versions"] = mirror_client_versions
        if mirror_client_versions == None:
            min_client_version = self.driver.find_element(By.XPATH, "//label[text()='Min Version']/following-sibling::div//input").get_attribute("value")
            value_dict["min_client_version"] = min_client_version
            max_client_version = self.driver.find_element(By.XPATH, "//label[text()='Max Version']/following-sibling::div//input").get_attribute("value")
            value_dict["max_client_version"] = max_client_version
        allow_HTTP2 = self.driver.find_element(By.XPATH, sslDecryptionProfiles_switch_allowHTTP2_posXpath).get_attribute("aria-checked")
        value_dict["allow_HTTP2"] = allow_HTTP2
        # 点击 Cancel
        self.driver.find_element(By.CSS_SELECTOR, sslDecryptionProfiles_button_cancel_posCss).click()

        return value_dict

    @screenshot_on_failure
    def chk_query_spec_chr(self, data):
        # 跳转到 hijack_page
        self._goto_subProfilePage()

        # 点击search查询框
        self.driver.find_element(By.ID, mainPage_profileSearch_selectLabel_posId).click()
        # 循环输入查询内容
        for key, value in data.items():

            if "_" in key:
                key = key.replace("_", " ")  # 将下划线替换为空格 listPage_profileSearch_hijackFiles_dropDown_item_posXpath
            dropdown_item_posXpath = listPage_profileSearch_sslDecryptionProfiles_dropDown_item_posXpath.format(replaceName=key)
            self.driver.find_element(By.XPATH, dropdown_item_posXpath).click()  # 点击下拉item
            input_item_posXpath = listPage_profileSearch_sslDecryptionProfiles_input_itemContent_posXpath.format(
                replaceName=key)
            self.driver.find_element(By.XPATH, input_item_posXpath).send_keys(value.strip())  # 输入查询值
            self.driver.find_element(By.XPATH, input_item_posXpath).send_keys(Keys.ENTER)  # 模拟回车按键
            # 点击查询按钮
            element_search = self.driver.find_element(By.ID, mainPage_profileSearch_buttonSearch_posId)
            self.driver.execute_script("arguments[0].click()", element_search)  # 强制点击
            if key == "ID":
                content = self.driver.find_element(By.XPATH, "//p[text()=\"ID only supports numbers and English characters\',\'\"]").text
                pytest_check.equal(content,
                    "ID only supports numbers and English characters','",msg="所在行数{}".format(inspect.currentframe().f_lineno))

            if key == "Name":
                val = self.driver.find_element(By.XPATH, input_item_posXpath).text
                pytest_check.equal(len(val) < 256,
                                   True, msg="所在行数{}".format(inspect.currentframe().f_lineno))
            # 强制点击清空查询按钮
            element_clear = self.driver.find_element(By.ID, listPage_profileSearch_sslDecryptionProfiles_buttonClear_posId)
            self.driver.execute_script("arguments[0].click()", element_clear)  # 强制点击

    def _audit_log_all_operation(self, data):
        ran_name = self._create(data)
        try:
            time.sleep(0.5)
            search_dict = self._query(data, Name=ran_name)
            self._modify(data)
            time.sleep(0.5)
        except Exception as e:
            raise e
        finally:
            self._query(data, Name=ran_name)
            self._del()
        self.profiles_po.audit_log_view("SSL Decryption Profile", search_dict["ID"])

    create = _create
    query = _query
    modify = _modify
    delete = _del
    column_setting = _column_setting
    turn_pages = _turn_pages
    language_change = _language_change
    vsys_case = _vsys_case
    vsys_check = _vsys_check
    audit_log = _audit_log
    policy_create = _policy_create
    policy_query = _policy_query
    policy_delete = _policy_del
    referenceCount_view = _referenceCount_view
    buildin_check = _buildin_check

if __name__ == '__main__':
    chrome_option = webdriver.ChromeOptions()
    a = MyWebDriver(
        command_executor="http://192.168.64.23:4444",
        options=chrome_option
    )
    a.get("http://192.168.44.72")
    a.maximize_window()
    a.find_element(By.XPATH, "//*[@id='app']/div/div[1]/div[2]/div[2]/div[1]/div/input").send_keys("AUTO_UI_TEST_KG")
    a.find_element(By.XPATH, "//*[@id='app']/div/div[1]/div[2]/div[2]/div[2]/div/input").send_keys("kongweibin1")
    a.find_element(By.ID, "login").click()
    time.sleep(2)
    # 测试修改数据
    r = SSLDecryptionProfiles(a)
    # profile_pub = ProfilesPublicOperations(r)
    # profile_pub.change_vsys(vsys_name='UIAutoTestVsys')
    # model=0/1 ====0:单个   1group
    # type =IMSI/Phone_Number/IMEI
    data = {
        "ids": "创建ssl_decryption_profiles_fail_action_on再修改common_name_off22",
        "model": "modify",
        "common_name": "on->off",
        "issuer": "on->on",
        "self_signed": "on->off",
        "expiry_date": "on->on",
        "fail_action": "Pass-through->不修改",
        "ev_certificate": "off->on",
        "certificate_transparency": "off->不修改",
        "mutual_authentication": "on->不修改",
        "protocol_errors": "on->off",
        "certificate_pinning": "on->on",
        "certificate_not_installed": "off->on",
        "mirror_client_versions": "on->on",
        "allow_HTTP2": "on->off"
    }
    # 测试link
    link_parse = configparser.ConfigParser()
    link_parse_dir = os.path.join(workdir, "config", "linkcluster.ini")
    link_parse.read(link_parse_dir, encoding="utf-8")
    link_list_dict = []
    link_list = [2]  # 可取值 1、2、 3、4、5   #这些取值来自linkcluster.ini配置文件
    for i in link_list:
        tmp_dict = {}
        link_index = "link_{}".format(i)
        tmp_dict["link_dst_cluster"] = link_parse.get(link_index, "link_dst_cluster")
        tmp_dict["link_dst_vsys"] = link_parse.get(link_index, "link_dst_vsys")
        tmp_dict["url"] = link_parse.get(link_index, "url")
        tmp_dict["username"] = link_parse.get(link_index, "username")
        tmp_dict["passwd"] = link_parse.get(link_index, "passwd")
        link_list_dict.append(copy.deepcopy(tmp_dict))
    print(link_list_dict)
    """   传参查考
    link_list_dict = [
        {
            "link_dst_cluster": "42.49-User4Link",
            "link_dst_vsys": "Vsys2test",
            "url": "http://192.168.42.49/#/login",
            "username": "admin",
            "passwd": "admin"
         },
    ]
    """
    r.chk_lnk_butin_data_case(data, link_list_dict=link_list_dict)