summaryrefslogtreecommitdiff
path: root/common/ui_common/objects/objects_public_operations.py
blob: b33480341e4c8b9601d8358108af37fd79b230e0 (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
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
import configparser
import datetime
import os
import inspect
import socket

import pytest_check
from selenium.common.exceptions import StaleElementReferenceException
from selenium.webdriver import ActionChains
from selenium.webdriver.remote.webelement import WebElement
from common.driver_common.random_name import RandomName
import pytest
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import random
import time
from common.ui_common.login_logout import loginout
from common.driver_common.mywebdriver import MyWebDriver
from common.driver_common.screenshot import screenshot_on_failure
from common.read_data.read_data import ReadData
from common.ui_common.profiles.profiles_public_operations import ProfilesPublicOperations
from config.workpath import workdir
from page_element.admin_area_element_position import *
from page_element.objects_element_position import *
from page_element import objects_element_position
from selenium import webdriver
# from cases.conftest import demo_fixture
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from page_element.ln_objects_element_position import *
from page_element.policies_element_position import *
import shutil
from common.ui_common.login_logout.loginout import LogInOut
from page_element.profiles_element_position import mainpage_button_menu_posxpath


# 下载文件《不需要实例化类》不写在类方法下
def download_files():
    my_files = ReadData()
    options = webdriver.ChromeOptions()

    # options.add_argument("--incognito")  # 添加启用无痕模式的选项
    options.add_argument("--window-size=1920,1080")  # 启动时默认大小窗口
    # options.add_argument('--headless')  # 启用Headless模式
    options.add_argument('--disable-gpu')  # 禁用 GPU 硬件加速

    prefs = {'download.default_directory': my_files._obj_files_dowload_path()}
    options.add_experimental_option('prefs', prefs)
    loginout_parse = configparser.ConfigParser()
    loginout_parse_dir = os.path.join(workdir, "config", "loginout.ini")
    loginout_parse.read(loginout_parse_dir, encoding="utf-8")
    driver = MyWebDriver(
        command_executor=loginout_parse.get("remote_url", "url"),
        options=options)
    tsglogin_url = loginout_parse.get("tsg_url", "login_url")
    driver.get(tsglogin_url)
    driver.maximize_window()

    # Login
    # 需要判断,遇到https不安全时,点击高级-继续登录才可以访问https-tsg
    if "https" in tsglogin_url:
        print(2)
        driver.isElementExist("//*[@id='details-button']")
        if driver.Exist:
            print(3)
            if "高级" in driver.find_element(By.XPATH, "//*[@id='details-button']").text.strip():
                print(4)
                driver.find_element(By.XPATH, "//*[@id='details-button']").click()
                driver.find_element(By.XPATH, "//*[@id='proceed-link']").click()
    # 输入账户和密码
    driver.find_element(By.XPATH, '//input[@placeholder="User name"]').send_keys(loginout_parse.get("ui_account_1", "username"))
    driver.find_element(By.XPATH, '//input[@placeholder="Password"]').send_keys(loginout_parse.get("ui_account_1", "passwd"))
    driver.find_element(By.XPATH, '//*[@id=":r0:"]').click()
    myloginout = LogInOut
    # 消除右上角弹框
    close_button_elem_Xpath = '(//i[@class="iconfont icon-Delete_X"])[last()]'  # 全局右上提示窗关闭按钮(最新的一个)
    driver.isElementExist(close_button_elem_Xpath)
    loop_count = 2
    while loop_count > 0:
        try:
            driver.isElementExist(close_button_elem_Xpath)
            if driver.Exist:
                driver.find_element(By.XPATH, close_button_elem_Xpath).click()
            loop_count -= 1
        except:
            loop_count -= 1
            pass
    # 切换至默认ui_vsys
    # loginout_parse = configparser.ConfigParser()
    # loginout_parse_dir = os.path.join(workdir, "config", "loginout.ini")
    # loginout_parse.read(loginout_parse_dir, encoding="utf-8")
    # # 切换UI自动化使用vsys
    # vsys_name = loginout_parse.get("vsys", "vsys_name")  # 登录后vsys切换为UIAutoTestVsys
    # # print(vsys_name)
    # profile_pub = ProfilesPublicOperations(driver)
    # profile_pub.change_vsys(vsys_name=vsys_name)
    # 默认更改为英语
    # myloginout._default_language()
    return driver


def _vsys_account():
    options = webdriver.ChromeOptions()
    loginout_parse = configparser.ConfigParser()
    loginout_parse_dir = os.path.join(workdir, "config", "loginout.ini")
    loginout_parse.read(loginout_parse_dir, encoding="utf-8")
    driver = MyWebDriver(
        command_executor=loginout_parse.get("remote_url", "url"),
        options=options)
    tsglogin_url = loginout_parse.get("tsg_url", "login_url")
    driver.get(tsglogin_url)
    driver.maximize_window()
    driver.find_element(By.XPATH, "//div[1]/div/div[1]/div[2]/div[2]/div/input").send_keys(
        loginout_parse.get("ui_vsys_Case_1", "username"))
    driver.find_element(By.XPATH, "//div/div[1]/div[2]/div[3]/div/input").send_keys(
        loginout_parse.get("ui_vsys_Case_1", "passwd"))
    driver.find_element(By.ID, "login").click()
    login = LogInOut(driver)
    login.dismiss_right_top_tips()
    return driver


def get_txt_filenames(path):  # 《不需要实例化类》不写在类方法下
    filenames = []
    for filename in os.listdir(path):
        if filename.endswith('.txt'):
            filenames.append(filename)

    return str(filenames[0])


def get_lua_filenames(path):  # 《不需要实例化类》不写在类方法下
    filenames = []
    for filename in os.listdir(path):
        if filename.split('.lua'):
            filenames.append(filename)

    return str(filenames[0])


class ObjectsPublicOperations:
    def __init__(self, demo_fixture):
        self.driver = demo_fixture
        self.my_files = ReadData()
        self.my_random = RandomName()
        self.loginout_parse = configparser.ConfigParser()
        self._query = 1
        loginout_parse_dir = os.path.join(workdir, "config", "loginout.ini")
        self.loginout_parse.read(loginout_parse_dir, encoding="utf-8")
        self.vsys_name = self.loginout_parse.get("vsys", "vsys_name")  # 登录后vsys切换为UIAutoTestVsys
        self.profile_pub = ProfilesPublicOperations(self.driver)
        self.wait = WebDriverWait(self.driver, 5)  # 最多等待5秒
        self.instances = {}
        ##geolocation、http_signatures、moible_identities、subscriber_ids等文件下的类名需更改
        self.obj_class_dict = {
            "accounts": "Accounts",
            "apns": "APNs",
            "asns": "ASNs",
            "categories": "Categories",
            "flags": "Flags",
            "intervals": "Intervals",
            "tunnels": "Tunnels",
            "urls": "URLs",
            "app_attributes": "Attributes",
            "app_signatures": "Signature",
            "application_groups": "AppGroup",
            "applications": "App",
            "fqdns": "FQDNs",
            "geolocation": "Geolocation",
            "http_signatures": "HTTP_Signatures",
            "ip_address": "IPAddress",
            "keywords": "Keywords",
            "moible_identities": "MobileIdentiities",
            "ports": "Ports",
            "subscriber_ids": "BaseSubscriberIDs"
        }

    def get_instance(self, obj_type):
        """
        检查 instances 字典中是否已经存在对应 obj_type 的实例。如果不存在,则导入模块、获取类并实例化,然后将实例存储在 instances 字典中。
        :param obj_type:
        :return:
        """
        if obj_type not in self.instances:
            import importlib
            class_name = self.obj_class_dict[obj_type]
            module_name = f'common.ui_common.objects.{obj_type}'
            module = importlib.import_module(module_name)
            class_obj = getattr(module, class_name)
            instance = class_obj(self.driver)
            self.instance = instance
            self.instances[obj_type] = instance
        return self.instances[obj_type]

    def object_operation(self, obj_type, obj_action, data):
        """
        根据obj_type和obj_action执行对应方法
        :param obj_type: 对象类型 eg:accounts
        :param obj_action:对象动作 eg:create/query/delete
        :param data:执行上述动作所需要的data
        :return:
        """
        instance = self.get_instance(obj_type)
        # 动态调用方法
        method = getattr(instance, obj_action)
        method(data)

    # 修改内容时,当内容为value,不是text时使用
    def clear_Name(self, path):
        """
        清除输入框内容
        :param path: path 也可是Selenium元素 XD
        :return:
        """
        # print("goTo_input {}".format(pathOrElement), type(pathOrElement))
        if isinstance(path, WebElement):  # 变量是WebElement类型
            element = path
        else:  # path
            element = self.driver.find_element(By.XPATH, path)
        # element.send_keys(Keys.CONTROL + 'a')
        element.send_keys(Keys.CONTROL + 'A')
        element.send_keys(Keys.DELETE)

    def assert_len_Name(self, data):
        j = 0
        for i in data["Name"]:
            j += 1
        return j

    def clear_name_by_id(self, xpath):
        element = self.driver.find_element(By.XPATH, xpath)
        element.send_keys(Keys.CONTROL + 'a')
        element.send_keys(Keys.DELETE)

    # 提取ID、Name、Description、Detail
    def extract_ele(self, need_exclude=1):
        """
        :param need_exclude: 是否需要获取exclude,默认1则获取,不为1则略过
        :return:
        """
        # self.driver.isElementExist(Element='//div/div[3]/table/tbody/tr[1]')  # 查看第一行是否存在数据
        self.driver.isElementExist(
            Element='//div[@aria-rowindex="2"]')  # 查看第一行是否存在数据
        if self.driver.Exist:
            # 展示所有列
            column_setting_btn = self.driver.find_element(By.XPATH,
                                                          mainPage_ObjectSearch_Column_settings_posXpath)  # 列设置按钮
            self.driver.execute_script("arguments[0].scrollIntoView();", column_setting_btn)
            column_setting_btn.click()  # 点击列设置
            self.driver.find_element(By.XPATH, '//span[text()="Vsys ID"]').click()
            self.driver.find_element(By.XPATH, '//span[text()="UUID" and contains(@class,"MuiTypography-body1")]').click()
            # self.driver.find_element(By.XPATH, "//input[@name='Show/Hide All']").click()
            # self.driver.find_element(By.XPATH, "//input[@name='Show/Hide All']").click()
            self.driver.find_element(By.XPATH, '//div[text()="Name"]').click()
            # all_checked_xpath = '//*[@class="all-btn"]//*[@class="el-checkbox__input is-checked"]'
            # if self.driver.element_isExist(By.XPATH, all_checked_xpath):  # 如果全选被选中
            #     self.driver.find_element(By.XPATH,
            #                              mainPage_ObjectSearch_Column_settings_click_Cancel_Button_posXpath).click()  # 点击Cancel按钮
            # else:
            #     self.driver.find_element(By.XPATH,
            #                              mainPage_ObjectSearch_Column_settings_select_allCheckBox_posXpath).click()  # 全选
            #     self.driver.find_element(By.XPATH,
            #                              mainPage_ObjectSearch_Column_settings_click_OK_Button_posXpath).click()  # 点击OK按钮

            # 公共方法 Detail特殊,需要使用时特殊提取
            # list_headers_template = '//div[@class="el-table__header-wrapper"]//span[text()="{}"]'
            # list_firstRow_values_template = '//div[contains(@class,"el-table__body-wrapper")]//tr[1]//td[count({a}/../../../preceding-sibling::th)+1]{b}'
            #
            # list_headers_id_posXpath = list_headers_template.format("ID")
            # list_headers_vsys_id_posXpath = list_headers_template.format("Vsys ID")
            # list_headers_name_posXpath = list_headers_template.format("Name")
            #
            # list_headers_description_posXpath = list_headers_template.format("Description")
            # list_headers_refer_count_posXpath = list_headers_template.format("Reference Count")
            #
            # list_firstRow_values_id_posXpath = list_firstRow_values_template.format(a=list_headers_id_posXpath,
            #                                                                         b='//div[@class="table-status-item-id"]//span')
            # list_firstRow_values_vsys_id_posXpath = list_firstRow_values_template.format(
            #     a=list_headers_vsys_id_posXpath, b='//*[text()]')
            # list_firstRow_values_name_posXpath = list_firstRow_values_template.format(a=list_headers_name_posXpath,
            #                                                                           b='//span')
            #
            # list_firstRow_values_description_posXpath = list_firstRow_values_template.format(
            #     a=list_headers_description_posXpath, b='//span') + "|" + list_firstRow_values_template.format(
            #     a=list_headers_description_posXpath, b='//p')
            # list_firstRow_values_refer_count_posXpath = list_firstRow_values_template.format(
            #     a=list_headers_refer_count_posXpath, b='//div[contains(@class,"textCenter")]')

            # self.key_id = self.driver.find_element(By.XPATH, list_headers_id_posXpath).text
            # self.value_id = self.driver.find_element(By.XPATH, list_firstRow_values_id_posXpath).text

            self.uuid_name = self.driver.find_element(By.XPATH, '//div[text()="UUID"]').text
            self.uuid_value = self.driver.find_element(By.XPATH,'//div[@aria-rowindex="2"]//div[@data-field="uuid"]').text

            self.key_vsys_id = self.driver.find_element(By.XPATH, '//div[text()="Vsys ID"]').text
            self.value_vsys_id = self.driver.find_element(By.XPATH, '//div[@aria-rowindex="2"]//div[@data-field="vsys"]').text

            self.key_name = self.driver.find_element(By.XPATH, '//div[text()="Name"]').text
            self.value_name = self.driver.find_element(By.XPATH, '//div[@aria-rowindex="2"]//span[@class="truncate"]').text

            self.key_des = self.driver.find_element(By.XPATH, '//div[text()="Description"]').text
            self.value_des = self.driver.find_element(By.XPATH, '//div[@aria-rowindex="2"]//div[@data-field="description"]').text
            # self.key_refer_count = self.driver.find_element(By.XPATH, '//div[@class="MuiDataGrid-columnHeaderTitle css-mh3zap" and text()="Usage"]').text
            # self.value_refer_count = self.driver.find_element(By.XPATH, list_firstRow_values_refer_count_posXpath).text

            if need_exclude == 1:
                # list_headers_exclude_posXpath = list_headers_template.format("Exclude Members")
                # list_firstRow_values_exclude_posXpath = list_firstRow_values_template.format(
                #     a=list_headers_exclude_posXpath,
                #     b='//div[@class="bifangWidth"]|div[@class="three-row list-popover-click"]')
                self.key_exclude = self.driver.find_element(By.XPATH, '//div[text()="Exclude Members"]').text
                self.value_exclude = self.driver.find_element(By.XPATH, '//div[@aria-rowindex="2"]//div[@data-field="exclude_sub_object_list"]').text
                self.table_dict = {self.key_vsys_id: self.value_vsys_id,self.uuid_name:self.uuid_value,self.key_name: self.value_name, self.key_exclude: self.value_exclude,
                                   self.key_des: self.value_des,"Details": "null"}

            else:
                self.table_dict = {self.uuid_name:self.uuid_value,self.key_vsys_id: self.value_vsys_id,self.key_name: self.value_name, self.key_des: self.value_des,
                                   "Details": "null"}
            # print("extract_ele TEST:{}".format(self.table_dict))
            return self.table_dict

        #     try:
        #         self.driver.isElementExist(Element=list_second_row_sixth_column_posXpath)
        #         if self.driver.Exist:
        #             self.value26 = self.driver.find_element(By.XPATH, list_second_row_sixth_column_posXpath).text
        #         else:
        #             self.driver.isElementExist(Element='//table/tbody/tr[1]/td[6]/div/span')
        #             if self.driver.Exist:
        #                 self.value26 = self.driver.find_element(By.XPATH, '//table/tbody/tr[1]/td[6]/div/span').text
        #             else:
        #                 self.value26 = "null"
        #     except:
        #         pass
        #     self.table_dict = {self.key11: self.value12, self.key12: self.value22, self.key13: self.value23,
        #                        "Datails": "null", self.key15: self.value25, self.key16: self.value26}
        # else:
        #     assert self.driver.Exist

    # def extract_ele(self):
    #     # self.driver.isElementExist(Element='//div/div[3]/table/tbody/tr[1]')  # 查看第一行是否存在数据
    #     self.driver.isElementExist(Element='((//div[@class!="itemDetails cursor"]//table[@class="el-table__body"])[1]//tr)[1]')  # 查看第一行是否存在数据
    #     if self.driver.Exist:
    #         # 公共方法 Detail特殊,需要使用时特殊提取
    #         # ID
    #         self.key11 = self.driver.find_element(By.XPATH, list_first_row_first_column_posXpath).text
    #         self.value12 = self.driver.find_element(By.XPATH, list_second_row_first_column_posXpath).text
    #         # Vsy_ID
    #         self.key12 = self.driver.find_element(By.XPATH, list_first_row_second_column_posXpath).text
    #         self.value22 = self.driver.find_element(By.XPATH, list_second_row_second_column_posXpath).text
    #         # Name
    #         self.key13 = self.driver.find_element(By.XPATH, list_first_row_third_column_posXpath).text
    #         self.value23 = self.driver.find_element(By.XPATH, list_second_row_third_column_posXpath).text
    #         # Exclude Members
    #         self.key15 = self.driver.find_element(By.XPATH, list_first_row_fifth_column_posXpath).text
    #         self.value25 = self.driver.find_element(By.XPATH, list_second_row_fifth_column_posXpath).text
    #         # Description
    #         self.key16 = self.driver.find_element(By.XPATH, list_first_row_sixth_column_posXpath).text
    #         try:
    #             self.driver.isElementExist(Element=list_second_row_sixth_column_posXpath)
    #             if self.driver.Exist:
    #                 self.value26 = self.driver.find_element(By.XPATH, list_second_row_sixth_column_posXpath).text
    #             else:
    #                 self.driver.isElementExist(Element='//table/tbody/tr[1]/td[6]/div/span')
    #                 if self.driver.Exist:
    #                     self.value26 = self.driver.find_element(By.XPATH, '//table/tbody/tr[1]/td[6]/div/span').text
    #                 else:
    #                     self.value26 = "null"
    #         except:
    #             pass
    #         self.table_dict = {self.key11: self.value12, self.key12: self.value22, self.key13: self.value23,
    #                            "Datails": "null", self.key15: self.value25, self.key16: self.value26}
    #     else:
    #         assert self.driver.Exist

    # print(self.table_dict)

    # if data["Createmodel"] == "0" and data["Createtype"] != "IP_Learnig":
    #     self.Details = self.driver.find_element(By.XPATH,listPage_object_mobileIdentities_new_Details_extract_posXpath).text
    # self.ID = self.driver.find_element(By.XPATH,listPage_object_mobileIdentities_new_ID_extract_posXpath).text
    # self.Name = self.driver.find_element(By.XPATH,listPage_object_mobileIdentities_new_Name_extract_posXpath).text
    # self.Description = self.driver.find_element(By.XPATH,listPage_object_mobileIdentities_new_Description_extract_posXpath).text

    def extract_ele_flag(self, need_exclude=1):
        """
        :param need_exclude: 是否需要获取exclude,默认1则获取,不为1则略过
        :return:
        """
        # self.driver.isElementExist(Element='//div/div[3]/table/tbody/tr[1]')  # 查看第一行是否存在数据
        self.driver.isElementExist(
            Element='//div[@aria-rowindex="2"]')  # 查看第一行是否存在数据
        if self.driver.Exist:
            # 展示所有列
            column_setting_btn = self.driver.find_element(By.XPATH,
                                                          mainPage_ObjectSearch_Column_settings_posXpath)  # 列设置按钮
            self.driver.execute_script("arguments[0].scrollIntoView();", column_setting_btn)
            column_setting_btn.click()  # 点击列设置
            # self.driver.find_element(By.XPATH, '//span[text()="Vsys ID"]').click()
            self.driver.find_element(By.XPATH, '//span[text()="UUID"]').click()
            self.driver.find_element(By.XPATH, '//div[text()="Name"]').click()
            # self.driver.find_element(By.XPATH, '//div[text()="Vsys ID"]').click()
            # all_checked_xpath = '//*[@class="all-btn"]//*[@class="el-checkbox__input is-checked"]'
            # if self.driver.element_isExist(By.XPATH, all_checked_xpath):  # 如果全选被选中
            #     self.driver.find_element(By.XPATH,
            #                              mainPage_ObjectSearch_Column_settings_click_Cancel_Button_posXpath).click()  # 点击Cancel按钮
            # else:
            #     self.driver.find_element(By.XPATH,
            #                              mainPage_ObjectSearch_Column_settings_select_allCheckBox_posXpath).click()  # 全选
            #     self.driver.find_element(By.XPATH,
            #                              mainPage_ObjectSearch_Column_settings_click_OK_Button_posXpath).click()  # 点击OK按钮

            # 公共方法 Detail特殊,需要使用时特殊提取
            # list_headers_template = '//div[@class="el-table__header-wrapper"]//span[text()="{}"]'
            # list_firstRow_values_template = '//div[contains(@class,"el-table__body-wrapper")]//tr[1]//td[count({a}/../../../preceding-sibling::th)+1]{b}'
            #
            # list_headers_id_posXpath = list_headers_template.format("ID")
            # list_headers_vsys_id_posXpath = list_headers_template.format("Vsys ID")
            # list_headers_name_posXpath = list_headers_template.format("Name")
            #
            # list_headers_description_posXpath = list_headers_template.format("Description")
            # list_headers_refer_count_posXpath = list_headers_template.format("Reference Count")
            #
            # list_firstRow_values_id_posXpath = list_firstRow_values_template.format(a=list_headers_id_posXpath,
            #                                                                         b='//div[@class="table-status-item-id"]//span')
            # list_firstRow_values_vsys_id_posXpath = list_firstRow_values_template.format(
            #     a=list_headers_vsys_id_posXpath, b='//*[text()]')
            # list_firstRow_values_name_posXpath = list_firstRow_values_template.format(a=list_headers_name_posXpath,
            #                                                                           b='//span')
            #
            # list_firstRow_values_description_posXpath = list_firstRow_values_template.format(
            #     a=list_headers_description_posXpath, b='//span') + "|" + list_firstRow_values_template.format(
            #     a=list_headers_description_posXpath, b='//p')
            # list_firstRow_values_refer_count_posXpath = list_firstRow_values_template.format(
            #     a=list_headers_refer_count_posXpath, b='//div[contains(@class,"textCenter")]')

            # self.key_id = self.driver.find_element(By.XPATH, list_headers_id_posXpath).text
            # self.value_id = self.driver.find_element(By.XPATH, list_firstRow_values_id_posXpath).text
            self.uuid_name = self.driver.find_element(By.XPATH, '//div[text()="UUID"]').text
            self.uuid_value = self.driver.find_element(By.XPATH, '//div[@aria-rowindex="2"]//div[@data-field="uuid"]').text
            self.key_vsys_id = self.driver.find_element(By.XPATH, '//div[text()="Vsys ID"]').text
            self.value_vsys_id = self.driver.find_element(By.XPATH, '//div[@aria-rowindex="2"]//div[@data-field="vsys"]').text

            # self.uuid_name = self.driver.find_element(By.XPATH, '//div[text()="UUID"]').text
            # self.uuid_value = self.driver.find_element(By.XPATH, '//div[@aria-rowindex="2"]//div[@data-field="uuid"]').text
            self.key_name = self.driver.find_element(By.XPATH, '//div[text()="Name"]').text
            self.value_name = self.driver.find_element(By.XPATH, '//div[@aria-rowindex="2"]//span[@class="truncate"]').text

            self.key_des = self.driver.find_element(By.XPATH, '//div[text()="Description"]').text
            self.value_des = self.driver.find_element(By.XPATH, '//div[@aria-rowindex="2"]//div[@data-field="description"]').text
            # self.key_refer_count = self.driver.find_element(By.XPATH, '//div[@class="MuiDataGrid-columnHeaderTitle css-mh3zap" and text()="Usage"]').text
            # self.value_refer_count = self.driver.find_element(By.XPATH, list_firstRow_values_refer_count_posXpath).text

            if need_exclude == 1:
                # list_headers_exclude_posXpath = list_headers_template.format("Exclude Members")
                # list_firstRow_values_exclude_posXpath = list_firstRow_values_template.format(
                #     a=list_headers_exclude_posXpath,
                #     b='//div[@class="bifangWidth"]|div[@class="three-row list-popover-click"]')
                self.key_exclude = self.driver.find_element(By.XPATH, '//div[text()="Exclude Members"]').text
                self.value_exclude = self.driver.find_element(By.XPATH, '//div[@aria-rowindex="2"]//div[@data-field="exclude_sub_object_list"]').text
                self.table_dict = {self.uuid_name:self.uuid_value,self.key_vsys_id: self.value_vsys_id,self.key_name: self.value_name, self.key_exclude: self.value_exclude,
                                   self.key_des: self.value_des,"Details": "null"}

            else:
                self.table_dict = {self.uuid_name:self.uuid_value,self.key_vsys_id: self.value_vsys_id,self.key_name: self.value_name, self.key_des: self.value_des,
                                   "Details": "null"}
            # print("extract_ele TEST:{}".format(self.table_dict))
            return self.table_dict
    def licenese_Check(self):
        try:
            self.driver.isElementExist(Element='//div/div[1]/div[2]/div/div/div[3]/i')
            if self.driver.Exist:
                self.driver.find_element(By.XPATH, '//div/div[1]/div[2]/div/div/div[3]/i').click()
            else:
                pass
        except:
            pass

    # 修改后元素===》断言
    def assert_ele(self):
        self.driver.isElementExist(Element='//div/div[3]/table/tbody/tr[1]')  # 查看第一行是否存在数据
        if self.driver.Exist:
            # ID
            self.key11 = self.driver.find_element(By.XPATH, list_first_row_first_column_posXpath).text
            self.value12 = self.driver.find_element(By.XPATH, list_second_row_first_column_posXpath).text
            # Vsy_ID
            self.key12 = self.driver.find_element(By.XPATH, list_first_row_second_column_posXpath).text
            self.value22 = self.driver.find_element(By.XPATH, list_second_row_second_column_posXpath).text
            # Name
            self.key13 = self.driver.find_element(By.XPATH, list_first_row_third_column_posXpath).text
            self.value23 = self.driver.find_element(By.XPATH, list_second_row_third_column_posXpath).text
            # Details特殊,需要使用时特殊提取
            # Exclude Members
            self.key15 = self.driver.find_element(By.XPATH, list_first_row_fifth_column_posXpath).text
            self.value25 = self.driver.find_element(By.XPATH, list_second_row_fifth_column_posXpath).text
            # Description
            self.key16 = self.driver.find_element(By.XPATH, list_first_row_sixth_column_posXpath).text
            try:
                self.driver.isElementExist(Element=list_second_row_sixth_column_posXpath)
                if self.driver.Exist:
                    self.value26 = self.driver.find_element(By.XPATH, list_second_row_sixth_column_posXpath).text
                else:
                    self.driver.isElementExist(Element='//table/tbody/tr/td[6]/div//span')
                    if self.driver.Exist:
                        self.value26 = self.driver.find_element(By.XPATH, '//table/tbody/tr/td[6]/div//span').text
            except:
                self.value26 = "null"

            self.edit_table_dict = {self.key11: self.value12, self.key12: self.value22, self.key13: self.value23,
                                    "Datails": "null", self.key15: self.value25, self.key16: self.value26}
        else:
            assert self.driver.Exist

    #   根据"->"进行分割,进行修改
    def Modify_object(self, data: {}):
        self.output = data.get("Name")
        self.Name_list = self.output.split("->")
        # 判断是否需要修改Name
        self.create_name = self.Name_list[0]
        try:
            self.modify_name = self.Name_list[1]
        except:
            self.modify_name = None

    # 下载文件
    def download_files(self):
        my_files = ReadData()
        options = webdriver.ChromeOptions()
        prefs = {'download.default_directory': my_files._obj_files_dowload_path()}
        options.add_experimental_option('prefs', prefs)
        driver = MyWebDriver(
            command_executor=self.loginout_parse.get("remote_url", "url"),
            options=options)
        return driver

    def _split_assert(self, assert_content):
        self.count = assert_content.split("Total:")
        self.after_count = int(self.count[1]) + 1
        return "Total:{}".format(self.after_count)

    def Column_settings(self, Column):
        # 24.02待修改-已修改
        # 点击列设置
        self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_posXpath).click()
        # 全不选并确认
        # self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_select_allCheckBox_posXpath).click()
        # self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_select_allCheckBox_posXpath).click()
        # self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_select_Cancel_Button_posXpath).click()
        self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_select_CheckBox_posXpath).click()
        self.driver.find_element(By.XPATH, mainPage_Object_Title_Name_posXpath).click()
        # 全不选,选择展示Column并确认
        self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_posXpath).click()
        self.Column_text = self.driver.find_element(By.XPATH, Column).text
        # print(self.Column_text)
        self.driver.find_element(By.XPATH, Column).click()  # 选择目标Column
        self.driver.find_element(By.XPATH, mainPage_Object_Title_Name_posXpath).click()
        # self.driver.find_element(By.XPATH,mainPage_ObjectSearch_Column_settings_click_OK_Button_posXpath).click()  # 点击OK按钮
        self.Column_ele_ex(Column_text=self.Column_text)  # 调用校验方法
        # 全选并确认
        # self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_posXpath).click() # 点击列设置
        # self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_select_All_Button_posXpath).click()
        # self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_click_OK_Button_posXpath).click()
        self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_posXpath).click()  # 点击列设置
        self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_select_CheckBox_posXpath).click()
        self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_select_CheckBox_posXpath).click()
        self.driver.find_element(By.XPATH, mainPage_Object_Title_Name_posXpath).click()
        # 全选并取消
        self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_posXpath).click()  # 点击列设置
        self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_select_CheckBox_posXpath).click()
        self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_select_CheckBox_posXpath).click()
        self.driver.find_element(By.XPATH, mainPage_Object_Title_Name_posXpath).click()

    def View_statistics(self, edit_element):
        # 主界面View验证
        self.driver.find_element(By.XPATH, main_listPage_object_statistics_view_postXpath).click()
        self.driver.isElementExist(Element='//i[@class="iconfont icon-Clear_aNormal close-icon"]')
        assert self.driver.Exist, "Statistics界面打开"
        self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
        time.sleep(2)
        # 详情界面Statistics验证
        # self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
        self.driver.find_element(By.XPATH, edit_element).click()
        self.driver.find_element(By.XPATH, '(//button[text()="Statistics"])[1]').click()
        self.driver.isElementExist(Element='(//i[@class="iconfont icon-Clear_aNormal close-icon"])[2]')
        assert self.driver.Exist, "Statistics界面打开"
        time.sleep(2)
        self.driver.find_element(By.XPATH, '(//i[@class="iconfont icon-Clear_aNormal close-icon"])[2]').click()
        time.sleep(2)

    def Duplicate_check(self, data):
        self.driver.isElementExist(Element=listPage_object_reprtition_check_postXpath)
        assert self.driver.Exist, "未存在重复标识"
        if data["repetition_type"] == "0":
            # 侧滑部分校验
            self.driver.find_element(By.XPATH, listPage_object_reprtition_check_postXpath).click()
            self.total_count = self.driver.find_element(By.XPATH,listPage_object_reprtition_total_postXpath).text
            self.count = self.total_count.split("Total:")
            print(self.count[1])
            assert self.count[1] == '1'
            # 悬浮框内容校验
            element_to_hover_over = self.driver.find_element(By.XPATH,
                                                             "//div[@class='TableList floatleft overflow-y-auto width100']//div[@class='reference-box el-popover__reference']/span")
            ActionChains(self.driver).move_to_element(element_to_hover_over).perform()
            tooltip = WebDriverWait(self.driver, 10).until(
                EC.visibility_of_element_located((By.XPATH, '//div[@x-placement="right-start"]'))
            )
            # 行符分割为列表
            hover_tooltip = tooltip.text.splitlines()
            # 列表转换为字典
            result_dict = {}
            for i in range(0, len(hover_tooltip), 2):
                if i + 1 < len(hover_tooltip):  # 确保存在下一行
                    key = hover_tooltip[i].strip()  # 去除首尾空格作为键
                    value = hover_tooltip[i + 1].strip()  # 去除首尾空格作为值
                    result_dict[key] = value
            try:
                assert data["Create"]["item"][0] == result_dict["Item"].split()[0],"校验悬浮框item值"
            except KeyError:
                assert list(data["Create"]["item"].values())[0] == result_dict["Item"].split()[0],"校验悬浮框item值"

    # Gary‘s Duplicate_check
    def verify_duplicate_items(self, data, obj_type):
        self.driver.isElementExist(Element=listPage_object_reprtition_check_postXpath)
        assert self.driver.Exist, "校验失败!!重复标志不存在!!"
        if data["repetition_type"] == "0":
            # 侧滑部分校验
            self.driver.find_element(By.XPATH, listPage_object_reprtition_check_postXpath).click()
            total_count = self.driver.find_element(By.XPATH,
                                                   listPage_object_reprtition_total_postXpath).text
            count = total_count.split("Total:")
            assert int(count[1]) >= 1, "校验失败!"
            # 悬浮框内容校验
            # element_to_hover_over = self.driver.find_element(By.XPATH,
            #                                                  "//div[@class='TableList floatleft overflow-y-auto width100']//div[@class='reference-box el-popover__reference']/span")
            # ActionChains(self.driver).move_to_element(element_to_hover_over).perform()
            # tooltip = WebDriverWait(self.driver, 10).until(
            #     EC.visibility_of_element_located((By.XPATH, '//div[contains(@x-placement,"-start")]')))
            # # 行符分割为列表
            # hover_tooltip = tooltip.text.splitlines()
            # # 列表转换为字典
            # result_dict = {}
            # for i in range(0, len(hover_tooltip), 2):
            #     if i + 1 < len(hover_tooltip):  # 确保存在下一行
            #         key = hover_tooltip[i].strip()  # 去除首尾空格作为键
            #         value = hover_tooltip[i + 1].strip()  # 去除首尾空格作为值
            #         result_dict[key] = value
            # if obj_type == "asns":
            #     data_item = data["Items"]["IPv4"][0].split("->")[0].strip()
            #     tooltip_item = result_dict["Item"].split(" ")[-1].strip()
            # elif obj_type == "flags":
            #     # todo 修改验证
            #     data_item = data["Items"][0][0].split("->")[0].strip()
            #     tooltip_item = data_item
            # elif obj_type == "intervals":
            #     data_item = data["Items"][0].split("->")[0].strip()
            #     if type(data_item) == type("abc"):
            #         l = eval(data_item)  # 将字符串转换为列表
            #     elif type(data_item) == type([1, 2]):
            #         l = data_item
            #     a = l[0]  # 获取列表的第一个元素
            #     b = l[1]  # 获取列表的第二个元素
            #     int_items_values = str(a) + " - " + str(b)  # 将两个元素用"-"连接,并转换为字符串
            #     data_item = int_items_values  # "11-22"
            #     tooltip_item = result_dict["Item"]
            # else:
            #     data_item = data["Items"][0].split("->")[0].strip()
            #     tooltip_item = result_dict["Item"].strip()
            # try:
            #     assert data_item == tooltip_item
            # except KeyError:
            #     # assert list(data["Create"]["item"].values())[0] == result_dict["Item"].strip()[0]
            #     raise KeyError

    # 判断列元素
    def Column_ele_ex(self, Column_text):
        data = "//*[@id='root']/div/div/main/div[1]/div[2]/div[2]/div[1]/div[1]/div/div/div['replace']/div[1]/div/div/div"
        # for i in range(1, 13):
        self.result = True
        i = 1
        while self.result == False:
            if i == 1:
                self.title = data.replace("div['replace']/div[1]/div/div/div", "div[{}]/div[1]/div/div/div".format(i))
                self.title_text = self.driver.find_element(By.XPATH, self.title)
                if Column_text == self.title_text:
                    self.result = True
                    print("校验通过")
                    break
                else:
                    i += 1

            else:
                self.title = data.replace("div['replace']/div[1]/div/div/div", "div[{}]/div[1]/div/div/div".format(i))
                self.title_text = self.driver.find_element(By.XPATH, self.title)
                if Column_text == self.title_text:
                    self.result = True
                    break
                else:
                    i += 1

    # 翻页操作
    def pages_turning(self, data, page_flag=1):
        """
        页码跳转
        :param data:
        :param page_flag: 1-Object列表页,2-对象组添加对象时的侧滑列表页
        :return:
        data示例:{
          "ids": "翻页操作T014-1",
          "//": "注释!直接跳转至对应页面,如destination_page为0则进行随机遍历跳转",
          "turn_mode": 1,
          "destination_page": "0"
          },
        :param page_flag: 1-Object列表页,2-对象组添加对象时的侧滑列表页
        """

        # self.driver.implicitly_wait(5)
        turn_mode = data["turn_mode"]  # data中翻页模式
        destination_page_number = data["destination_page"]  # data中目标页码
        self.turn_page_falg = 1

        listPage_max_page_elem_is_exist = self.driver.element_isExist(By.XPATH,
                                                                      listPage_object_pages_maxPageNumber_posXpath)
        DrawerlistPage_max_page_elem_is_exist = self.driver.element_isExist(By.XPATH,
                                                                            DrawerlistPage_object_pages_maxPageNumber_posXpath)
        if listPage_max_page_elem_is_exist or DrawerlistPage_max_page_elem_is_exist:  # 存在页码
            if page_flag == 1:  # 1-Object列表页
                # 拿翻页前后的同一元素,用于校验翻页后页面内容是否刷新
                page_elem_posXpath = listPage_fist_object_id_poxXpath  # 取列表页第一个Object的ID
                # 获取页面中最大页码
                max_page_elem_Xpath = listPage_object_pages_maxPageNumber_posXpath
                max_page_number = self.driver.find_element(By.XPATH, max_page_elem_Xpath).text
                # print("max_page_number:{}".format(max_page_number))
                # 前一页按钮
                previousPage_button = self.driver.find_element(By.XPATH,
                                                               listPage_object_pages_previousPage_button_poxXpath)
                # 后一页按钮
                nextPage_button = self.driver.find_element(By.XPATH, listPage_object_pages_nextPage_button_poxXpath)
                # Goto 输入框
                goTo_input = self.driver.find_element(By.XPATH, listPage_object_pages_goTo_input_poxXpath)
                # 当前页码元素
                currentPageNumber_posXpath = listPage_object_pages_currentPageNumber_posXpath
                # 页面中目标页码元素模板
                destination_page_elem_XpathTemple = '//div[@class="page-box-containcheck"]//li[text()={}]'
                # # 快速后翻页按钮Xpath
                # quicNext_button_Xpath = listPage_object_pages_quickNextPage_button_poxXpath
                # # 快速前翻页按钮Xpath
                # quickPrevious_button_Xpath = listPage_object_pages_quickPreviousPage_button_poxXpath
            else:  # 2-对象组添加对象时的侧滑列表页
                # 拿翻页前后的同一元素,用于校验翻页后页面内容是否刷新
                page_elem_posXpath = '(//div[@class="ToggleDraw"]//span[@class="ellipsis list-popover-click"])[1]'  # 取列表页第一个Object的name
                # 获取页面中最大页码
                max_page_elem_Xpath = DrawerlistPage_object_pages_maxPageNumber_posXpath
                max_page_number = self.driver.find_element(By.XPATH, max_page_elem_Xpath).text
                # print("max_page_number:{}".format(max_page_number))
                # 前一页按钮
                previousPage_button = self.driver.find_element(By.XPATH,
                                                               DrawerlistPage_object_pages_previousPage_button_poxXpath)
                # 后一页按钮
                nextPage_button = self.driver.find_element(By.XPATH,
                                                           DrawerlistPage_object_pages_nextPage_button_poxXpath)
                # Goto 输入框
                goTo_input = self.driver.find_element(By.XPATH, DrawerlistPage_object_pages_goTo_input_poxXpath)
                # 当前页码元素
                currentPageNumber_posXpath = DrawerlistPage_object_pages_currentPageNumber_posXpath
                # 页面中目标页码元素模板
                destination_page_elem_XpathTemple = '//div[@class="ToggleDraw"]//li[text()={}]'

                # # 快速后翻页按钮Xpath
                # quicNext_button_Xpath = listPage_object_pages_quickNextPage_button_poxXpath
                # # 快速前翻页按钮Xpath
                # quickPrevious_button_Xpath = listPage_object_pages_quickPreviousPage_button_poxXpath

            if int(max_page_number) == 1:  # 只有1页则跳过
                self.turn_page_falg = 0
                # try:
                #     # 切换至Vsys0
                #     loginout_parse_dir = os.path.join(workdir, "config", "loginout.ini")
                #     self.loginout_parse.read(loginout_parse_dir, encoding="utf-8")
                #     vsys_name = self.loginout_parse.get("vsys0", "vsys_name")
                #     profile_pub = ProfilesPublicOperations(self.driver)
                #     profile_pub.change_vsys(vsys_name=vsys_name)
                #     # self.driver.implicitly_wait(4)
                #
                #     max_page_number_elem = WebDriverWait(self.driver, 10).until(
                #         EC.visibility_of_element_located((By.XPATH, max_page_elem_Xpath))
                #     )
                #     max_page_number = max_page_number_elem.text
                #     if int(max_page_number) == 1:  # 只有1页则跳过
                #         self.driver.refresh()
                #         raise Exception("页码仅为1页,无法进行翻页操作!")
                #         # pytest.skip("页码仅为1页,无法进行翻页操作!")
                #     else:
                #         self._turn_page(page_elem_posXpath, turn_mode, destination_page_number, max_page_number,
                #                         previousPage_button,
                #                         nextPage_button,
                #                         goTo_input, currentPageNumber_posXpath, destination_page_elem_XpathTemple)
                # except Exception as e:
                #     print(e)
            else:
                self._turn_page(page_elem_posXpath, turn_mode, destination_page_number, max_page_number,
                                previousPage_button,
                                nextPage_button,
                                goTo_input, currentPageNumber_posXpath, destination_page_elem_XpathTemple)
        else:
            print(" 无页码元素,无法进行翻页操作--跳过")
            pass

    def _turn_page(self, page_elem_posXpath, turn_mode, destination_page_number, max_page_number, previousPage_button,
                   nextPage_button,
                   goTo_input, currentPageNumber_posXpath, destination_page_elem_XpathTemple):
        if turn_mode == 1:  # 直接跳转至对应页面,如destination_page为0则进行随机跳转
            if destination_page_number == "0" or int(destination_page_number) > int(max_page_number):  # 如destination_page为0或大于最大页码则进行随机跳转
                # 随机页码list
                # random_list = [(lambda a, b: random.randrange(a, b + 1))(1, int(max_page_number)) for i in
                #                range(int(int(max_page_number) / 2))]
                list_lenth = int(int(max_page_number) / 2)
                if list_lenth > 10:
                    list_lenth = 10
                    random_list = [(lambda a, b: random.randrange(a, b + 1))(1, int(max_page_number)) for i in
                                   range(list_lenth)]  # 10个随机页码,视情况自定义
                else:
                    random_list = [(lambda a, b: random.randrange(a, b + 1))(1, int(max_page_number)) for i in
                                   range(list_lenth)]
                    print("--------------------------------random_list:{}".format(random_list))
                for i in random_list:
                    # 或取页面中目标页码元素
                    destination_page_elem_Xpath = destination_page_elem_XpathTemple.format(i)

                    print("--------------------------------before _operate_turn_pages")
                    self._operate_turn_pages(i, destination_page_elem_Xpath, currentPageNumber_posXpath, goTo_input)
                    print("--------------------------------after _operate_turn_pages")
                    destination_page_elem = self.driver.find_element(By.XPATH, destination_page_elem_Xpath)
                    # previous_page_elem = self.driver.find_element(By.XPATH, page_elem_posXpath).text
                    previous_page_elem = self.wait.until(
                        EC.presence_of_element_located((By.XPATH, page_elem_posXpath))).text
                    destination_page_elem.click()
                    # next_page_elem = self.driver.find_element(By.XPATH, page_elem_posXpath).text
                    loop_count = 3
                    for loop in range(loop_count):
                        try:
                            next_page_elem = self.wait.until(
                                EC.presence_of_element_located((By.XPATH, page_elem_posXpath))).text
                            break
                        except:
                            time.sleep(1)
                    current_page_number = self.driver.find_element(By.XPATH,
                                                                   currentPageNumber_posXpath).text
                    if current_page_number != str(i):
                        assert previous_page_elem != next_page_elem
                    current_page_number = self.driver.find_element(By.XPATH,
                                                                   currentPageNumber_posXpath).text
                    # print("current_page_number:{a}|destination_page_number:{b}".format(a=current_page_number, b=str(i)))
                    assert current_page_number == str(i), "校验页码跳转失败!!dst= {}| crt ={} ".format(str(i),
                                                                                                       current_page_number)
            else:  # 正常跳转至目标页
                destination_page_elem_Xpath = destination_page_elem_XpathTemple.format(
                    destination_page_number)
                self._operate_turn_pages(destination_page_number, destination_page_elem_Xpath,
                                         currentPageNumber_posXpath, goTo_input)
                current_page_number = self.driver.find_element(By.XPATH,
                                                               currentPageNumber_posXpath).text
                destination_page_elem = self.driver.find_element(By.XPATH, destination_page_elem_Xpath)
                previous_page_elem = self.wait.until(
                    EC.presence_of_element_located((By.XPATH, page_elem_posXpath))).text
                destination_page_elem.click()
                loop_count = 5
                for loop in range(loop_count):
                    try:
                        next_page_elem = self.wait.until(
                            EC.presence_of_element_located((By.XPATH, page_elem_posXpath))).text
                        break
                    except:
                        time.sleep(1)
                # next_page_elem = self.driver.find_element(By.XPATH, page_elem_posXpath).text
                if current_page_number != destination_page_number:
                    assert previous_page_elem != next_page_elem, "翻页数据未刷新,previous_page_elem={},next_page_elem".format(
                        previous_page_elem, next_page_elem)
                assert self.driver.find_element(By.XPATH,
                                                currentPageNumber_posXpath).text == str(
                    destination_page_number), "校验页码跳转失败!!"
                print("翻页成功,{}".format(current_page_number))

        elif turn_mode == 2:  # 使用前一页或后一页按钮进行翻页,如destination_page为0则进行随机跳转
            if destination_page_number == "0" or int(destination_page_number) > int(
                    max_page_number):  # 如destination_page为0或大于最大页码则进行随机跳转
                random_page_number = random.randint(1, int(max_page_number))
                if random_page_number >= 10:
                    # print(f"destination_page{destination_page}")
                    self.clear_Name(goTo_input)
                    goTo_input.send_keys(int(random_page_number) - 4)
                    # 确认并执行跳转
                    goTo_input.send_keys(Keys.ENTER)  # 输入框中执行回车
                # print("random_page_number:{}".format(random_page_number))
                current_page_number = self.driver.find_element(By.XPATH,
                                                               currentPageNumber_posXpath).text
                while int(current_page_number) != random_page_number:
                    if int(current_page_number) < random_page_number:
                        previous_page_elem = self.driver.find_element(By.XPATH, page_elem_posXpath).text
                        nextPage_button.click()
                        loop_count = 5
                        for loop in range(loop_count):
                            try:
                                next_page_elem = self.wait.until(
                                    EC.presence_of_element_located((By.XPATH, page_elem_posXpath))).text
                                break
                            except:
                                time.sleep(1)
                        assert previous_page_elem != next_page_elem, "翻页数据未刷新,previous_page_elem={},next_page_elem".format(
                            previous_page_elem, next_page_elem)
                        current_page_number = self.driver.find_element(By.XPATH,
                                                                       currentPageNumber_posXpath).text
                    elif int(current_page_number) > random_page_number:
                        previousPage_button.click()
                        current_page_number = self.driver.find_element(By.XPATH,
                                                                       currentPageNumber_posXpath).text
                    else:
                        break
                # print("current_page_number:{a}|destination_page_number:{b}".format(a=current_page_number,
                #                                                                    b=str(random_page_number)))
                assert self.driver.find_element(By.XPATH,
                                                currentPageNumber_posXpath).text == str(
                    random_page_number), "校验页码跳转失败!!"

            else:  # 正常跳转至目标页
                current_page_number = self.driver.find_element(By.XPATH,
                                                               currentPageNumber_posXpath).text
                while current_page_number != destination_page_number:
                    if int(current_page_number) < int(destination_page_number):
                        previous_page_elem = self.driver.find_element(By.XPATH, page_elem_posXpath).text
                        nextPage_button.click()
                        loop_count = 5
                        for loop in range(loop_count):
                            try:
                                next_page_elem = self.wait.until(
                                    EC.presence_of_element_located((By.XPATH, page_elem_posXpath))).text
                                break
                            except:
                                time.sleep(1)
                        assert previous_page_elem != next_page_elem, "翻页数据未刷新,previous_page_elem={},next_page_elem".format(
                            previous_page_elem, next_page_elem)
                        current_page_number = self.driver.find_element(By.XPATH,
                                                                       currentPageNumber_posXpath).text
                    elif int(current_page_number) > int(destination_page_number):
                        previousPage_button.click()
                        current_page_number = self.driver.find_element(By.XPATH,
                                                                       currentPageNumber_posXpath).text
                    else:
                        break
                # print("current_page_number:{a}|destination_page_number:{b}".format(a=current_page_number,
                #                                                                    b=destination_page_number))
                assert self.driver.find_element(By.XPATH,
                                                currentPageNumber_posXpath).text == str(
                    destination_page_number), "校验页码跳转失败!!"
        elif turn_mode == 3:  # 使用Go to页码数进行翻页,如destination_page为0则进行随机跳转
            if destination_page_number == "0" or int(destination_page_number) > int(
                    max_page_number):  # 如destination_page为0或大于最大页码则进行随机跳转
                random_page_number = random.randint(1, int(max_page_number))
                self.clear_Name(goTo_input)
                # 搜索框中键入搜索值
                goTo_input.send_keys(random_page_number)
                # 确认并执行跳转
                previous_page_elem = self.driver.find_element(By.XPATH, page_elem_posXpath).text
                goTo_input.send_keys(Keys.ENTER)  # 输入框中执行回车
                loop_count = 5
                for loop in range(loop_count):
                    try:
                        next_page_elem = self.wait.until(
                            EC.presence_of_element_located((By.XPATH, page_elem_posXpath))).text
                        break
                    except:
                        time.sleep(1)
                if random_page_number != 1:
                    assert previous_page_elem != next_page_elem, "翻页数据未刷新"
                # current_page_number = self.driver.find_element(By.XPATH,
                #                                                currentPageNumber_posXpath).text

                # print("current_page_number:{a}|destination_page_number:{b}".format(a=current_page_number,
                #                                                                    b=str(random_page_number)))
                assert self.driver.find_element(By.XPATH,
                                                currentPageNumber_posXpath).text == str(
                    random_page_number), "校验页码跳转失败!!"

            else:  # 正常跳转至目标页
                self.clear_Name(goTo_input)
                # 搜索框中键入搜索值
                goTo_input.send_keys(destination_page_number)
                # 确认并执行跳转
                previous_page_elem = self.driver.find_element(By.XPATH, page_elem_posXpath).text
                goTo_input.send_keys(Keys.ENTER)  # 输入框中执行回车
                next_page_elem = self.driver.find_element(By.XPATH, page_elem_posXpath).text
                assert previous_page_elem != next_page_elem, "翻页数据未刷新"
                # current_page_number = self.driver.find_element(By.XPATH,
                #                                                currentPageNumber_posXpath).text

                # print("current_page_number:{a}|destination_page_number:{b}".format(a=current_page_number,
                #                                                                    b=str(destination_page_number)))
                assert self.driver.find_element(By.XPATH,
                                                currentPageNumber_posXpath).text == str(
                    destination_page_number), "校验页码跳转失败!!"

        elif turn_mode == 4:  # 使用快速翻页按钮进行翻页,如destination_page为0则进行随机跳转
            if int(max_page_number) <= 6:
                pass
            else:
                if destination_page_number == "0" or int(destination_page_number) > int(
                        max_page_number):  # 如destination_page为0或大于最大页码则进行随机跳转
                    list_lenth = int(int(max_page_number) / 2)
                    if list_lenth > 10:
                        list_lenth = 10
                        # 随机页码list
                        random_list = [(lambda a, b: random.randrange(a, b + 1))(6, int(max_page_number)) for i in
                                       range(list_lenth)]
                    else:
                        random_list = [(lambda a, b: random.randrange(a, b + 1))(1, int(max_page_number)) for i in
                                       range(list_lenth)]
                    # print("random_list:{}".format(random_list))
                    for i in random_list:
                        # 或取页面中目标页码元素
                        destination_page_elem_Xpath = destination_page_elem_XpathTemple.format(
                            i)

                        self._operate_turn_pages(i, destination_page_elem_Xpath, currentPageNumber_posXpath, goTo_input)
                        destination_page_elem = self.driver.find_element(By.XPATH, destination_page_elem_Xpath)
                        previous_page_elem = self.driver.find_element(By.XPATH, page_elem_posXpath).text
                        destination_page_elem.click()
                        loop_count = 5
                        for loop in range(loop_count):
                            try:
                                next_page_elem = self.wait.until(
                                    EC.presence_of_element_located((By.XPATH, page_elem_posXpath))).text
                                break
                            except:
                                time.sleep(1)
                        current_page_number = self.driver.find_element(By.XPATH,
                                                                       currentPageNumber_posXpath).text
                        if current_page_number != str(i):
                            assert previous_page_elem != next_page_elem
                        current_page_number = self.driver.find_element(By.XPATH,
                                                                       currentPageNumber_posXpath).text
                        # print("current_page_number:{a}|destination_page_number:{b}".format(a=current_page_number,
                        #                                                                    b=str(i)))
                        assert current_page_number == str(i), "校验页码跳转失败!!dst= {}| crt ={} ".format(str(i),
                                                                                                           current_page_number)
                else:  # 正常跳转至目标页
                    destination_page_elem_Xpath = destination_page_elem_XpathTemple.format(
                        destination_page_number)
                    self._operate_turn_pages(destination_page_number, destination_page_elem_Xpath,
                                             currentPageNumber_posXpath, goTo_input)
                    destination_page_elem = self.driver.find_element(By.XPATH, destination_page_elem_Xpath)
                    destination_page_elem.click()
                    assert self.driver.find_element(By.XPATH,
                                                    currentPageNumber_posXpath).text == str(
                        destination_page_number), "校验页码跳转失败!!"

    def _operate_turn_pages(self, destination_page, destination_page_elem_Xpath, currentPageNumber_posXpath,
                            goTo_input):
        """
        针对页码快速跳转操作
        :param destination_page: 上层传递的目标页码
        :param destination_page_elem_Xpath: 上层传递的目标页码元素的Xpath
        :param currentPageNumber_posXpath: 上层传递的当前页码元素的Xpath
        :param goTo_input: 上层传递的Goto输入框元素的Xpath
        :return:
        """
        if int(destination_page) > 20:
            # print(f"destination_page{destination_page}")
            self.clear_Name(goTo_input)
            goTo_input.send_keys(int(destination_page) - 9)
            # 确认并执行跳转
            # previous_page_elem = self.driver.find_element(By.XPATH, page_elem_posXpath).text
            goTo_input.send_keys(Keys.ENTER)  # 输入框中执行回车
            # next_page_elem = self.driver.find_element(By.XPATH, page_elem_posXpath).text
            # assert previous_page_elem != next_page_elem, "翻页数据未刷新"
        while True:  # 判断目标页码元素是否存在
            print("----------------In while")
            self.driver.isElementExist(Element=destination_page_elem_Xpath)
            # print("isElementExist:{}".format(self.driver.Exist))
            current_page_number = self.driver.find_element(By.XPATH,
                                                           currentPageNumber_posXpath).text
            if not self.driver.Exist:
                print("-----------quick exist!!!!")

                if int(destination_page) > int(current_page_number):
                    # time.sleep(0.1)
                    # previous_page_elem = self.driver.find_element(By.XPATH, page_elem_posXpath).text
                    self.driver.find_element(By.XPATH, listPage_object_pages_quickNextPage_button_poxXpath).click()
                    # next_page_elem = self.driver.find_element(By.XPATH, page_elem_posXpath).text
                    # assert previous_page_elem != next_page_elem, "翻页数据未刷新"
                elif int(destination_page) < int(current_page_number):
                    # time.sleep(0.1)
                    # previous_page_elem = self.driver.find_element(By.XPATH, page_elem_posXpath).text
                    self.wait.until(EC.presence_of_element_located,
                                    ((By.XPATH, listPage_object_pages_quickPreviousPage_button_poxXpath)))
                    self.driver.find_element(By.XPATH, listPage_object_pages_quickPreviousPage_button_poxXpath).click()
                    # next_page_elem = self.driver.find_element(By.XPATH, page_elem_posXpath).text
                    # assert previous_page_elem != next_page_elem, "翻页数据未刷新"
            else:
                print("-----------quick not exist!!!! break")
                break

    # def pages_turning_case(self):
    #     # 1、获取当前页码 2、点击下一页翻页 3、断言翻页后,页码为当前页码+1
    #     self.current_page = int(
    #         self.driver.find_element(By.XPATH, listPage_object_pages_currentPageNumber_posXpath).text)
    #     self.max_page = int(
    #         self.driver.find_element(By.XPATH, listPage_object_pages_currentPageArea_MaxNumber_posXpath).text)
    #     if self.max_page > self.current_page:
    #         self.driver.find_element(By.XPATH, listPage_object_pages_nextPage_button_poxXpath).click()
    #         assert self.current_page + 1 == int(
    #             self.driver.find_element(By.XPATH, listPage_object_pages_currentPageNumber_posXpath).text)
    #     # 2、获取当前页码 2、点击上一页翻页 3、断言翻页后,页码展示为当前页码-1
    #     self.current_page = int(
    #         self.driver.find_element(By.XPATH, listPage_object_pages_currentPageNumber_posXpath).text)
    #     if self.current_page > 1:
    #         self.driver.find_element(By.XPATH, listPage_object_pages_previousPage_button_poxXpath).click()
    #         assert self.current_page - 1 == int(
    #             self.driver.find_element(By.XPATH, listPage_object_pages_currentPageNumber_posXpath).text)
    #     # 3、输入页码回车进行翻页
    #     self.max_page = int(
    #         self.driver.find_element(By.XPATH, listPage_object_pages_currentPageArea_MaxNumber_posXpath).text)
    #     if self.max_page <= 2:
    #         pass
    #     elif self.max_page > 2:
    #         self.clear_Name(path=listPage_object_pages_goTo_input_poxXpath)
    #         self.driver.find_element(By.XPATH, listPage_object_pages_goTo_input_poxXpath).send_keys(
    #             str(self.max_page / 2 + 1) + Keys.ENTER)
    #         assert int(self.max_page / 2 + 1) == int(self.driver.find_element(By.XPATH,
    #                                                                           listPage_object_pages_currentPageNumber_posXpath).text), "断言所翻页码处于当前页"
    #     # 4、点击第五页进行翻页
    #     self.driver.isElementExist(Element=listPage_object_pages_currentPageAreaMaxNumber_posXpath)
    #     if self.driver.Exist:
    #         self.last_page = int(
    #             self.driver.find_element(By.XPATH, listPage_object_pages_currentPageAreaMaxNumber_posXpath).text)
    #         self.driver.find_element(By.XPATH, listPage_object_pages_currentPageAreaMaxNumber_posXpath).click()
    #         assert self.last_page == int(self.driver.find_element(By.XPATH,
    #                                                               listPage_object_pages_currentPageNumber_posXpath).text), "断言所翻页码处于当前页"
    #     else:
    #         pass

    # 判断元素是否可点击
    def is_element_clickable(self, elm, elm_type="XPATH", timeout=2):
        """判断元素是否存在
        :param elm: 元素定位
        :param elm_type: 元素定位方式
        :return: 是否可点击
        """
        try:
            # 设置一个最大等待时间
            timeout = WebDriverWait(self.driver, timeout)
            if elm_type == 'ID':
                # 等待元素可点击
                timeout.until(EC.element_to_be_clickable((By.ID, elm)))
                return True
            elif elm_type == 'XPATH':
                # 等待元素可点击
                timeout.until(EC.element_to_be_clickable((By.XPATH, elm)))
                return True
            elif elm_type == 'CSS_SELECTOR':
                # 等待元素可点击
                timeout.until(EC.element_to_be_clickable((By.CSS_SELECTOR, elm)))
                return True
            elif elm_type == 'NAME':
                # 等待元素可点击
                timeout.until(EC.element_to_be_clickable((By.NAME, elm)))
                return True
        except:
            return False

    # 消除右上提示弹窗
    def dismiss_rightTopTips(self, close_button_elem_Xpath=mainPage_rightTopTips_closeButton_posXpath):
        """
        :param close_button_elem_Xpath:
        :return:
        """
        # print("消除弹窗")
        # time.sleep(3)
        self.driver.isElementExist(close_button_elem_Xpath)
        loop_count = 2
        while loop_count > 0:
            try:
                self.driver.isElementExist(close_button_elem_Xpath)
                if self.driver.Exist:
                    self.driver.find_element(By.XPATH, close_button_elem_Xpath).click()
                loop_count -= 1
            except:
                loop_count -= 1
                pass

        # try:
        #     self.driver.isElementExist(Element="//div/div[1]/div[2]/div/div[2]/div[3]/i")
        #     if self.driver.Exist:
        #         self.driver.find_element(By.XPATH,'//div/div[1]/div[2]/div/div[2]/div[3]/i').click()
        # except:
        #     pass
        # try:
        #     self.driver.isElementExist(Element="//div/div[1]/div[2]/div/div/div[3]/i")
        #     if self.driver.Exist:
        #         self.driver.find_element(By.XPATH,'//div/div[1]/div[2]/div/div/div[3]/i').click()
        # except:
        #     pass

        # self.driver.implicitly_wait(5)
        # self.driver.isElementExist(close_button_elem_Xpath)
        # flag = self.driver.Exist
        # loop_count = 2
        # while flag and loop_count > 0:
        #     try:
        #         self.driver.isElementExist(close_button_elem_Xpath)
        #         flag = self.driver.Exist
        #         # close_button_elem = self.driver.find_element(By.XPATH, close_button_elem_Xpath)
        #         if flag:
        #             # 1
        #             # for i in self.driver.find_elements(By.XPATH,close_button_elem_Xpath):
        #             #     i.click()
        #             # 2
        #             close_button_elem = self.driver.find_element_by_xpath(close_button_elem_Xpath)
        #             close_button_elem.click()
        #     except:
        #         self.driver.refresh()
        #         loop_count -= 1
        #         # break

    # 删除选中对象
    def delete(self, listPage_object_subObjects_delButton_posXpath, listPage_dialogTips_subObjects_button_yes_posXpath,
               listPage_dialogTips_subObjects_button_no_posXpath, ):

        self.driver.find_element(By.XPATH, listPage_object_subObjects_delButton_posXpath).click()  # 点击删除按钮
        random_yes_or_no = random.randint(0, 1)
        if random_yes_or_no == 0:  # 点击yes,删除
            self.driver.find_element(By.XPATH,
                                     listPage_dialogTips_subObjects_button_yes_posXpath).click()  # 直接删除
        else:
            self.driver.find_element(By.XPATH,
                                     listPage_dialogTips_subObjects_button_no_posXpath).click()  # 先取消,再删除
            self.driver.find_element(By.XPATH, listPage_object_subObjects_delButton_posXpath).click()  # 点击删除按钮
            self.driver.find_element(By.XPATH,
                                     listPage_dialogTips_subObjects_button_yes_posXpath).click()  # 点击yes,删除
        time.sleep(0.5)

    def common_delete(self):
        # 点击删除按钮
        del_button = self.wait.until(EC.presence_of_element_located((By.XPATH, listPage_deleteButton_posXpath)))
        del_button.click()
        # self.driver.find_element(By.XPATH, listPage_deleteButton_posXpath).click()  # 点击删除按钮
        # 确认弹窗确认
        yes_button = self.wait.until(
            EC.presence_of_element_located((By.CSS_SELECTOR, listPage_object_delete_yesButton_posCss)))
        yes_button.click()
        # self.driver.find_element(By.CSS_SELECTOR,
        #                          listPage_object_delete_yesButton_posCss).click()  # 点击yes,删除

    # 判断某目录下是否为空
    def delete_folder_contents(self, folder):
        # time.sleep(3)
        # 判断文件夹是否为空
        if os.listdir(folder):
            print('不为空')
            # 遍历文件夹下的所有文件和子文件夹
            for item in os.listdir(folder):
                # 拼接完整的路径
                path = os.path.join(folder, item)
                # 判断是文件还是文件夹
                if os.path.isfile(path):
                    # 删除文件
                    os.remove(path)
                elif os.path.isdir(path):
                    # 删除文件夹及其内容
                    shutil.rmtree(path)
        else:
            # 文件夹为空,不做任何操作
            print('该目录为空')
            pass

    def extract_ele_userdefinedAttributesAndSignatures(self):
        # self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_posXpath).click()  # 点击列设置
        # all_checked_xpath = '//*[@class="all-btn"]//*[@class="el-checkbox__input is-checked"]'
        # if self.driver.element_isExist(By.XPATH, all_checked_xpath):  # 如果全选被选中
        #     self.driver.find_element(By.XPATH,
        #                              mainPage_ObjectSearch_Column_settings_click_Cancel_Button_posXpath).click()  # 点击Cancel按钮
        # else:
        #     self.driver.find_element(By.XPATH,
        #                              mainPage_ObjectSearch_Column_settings_select_allCheckBox_posXpath).click()  # 全选
        #     self.driver.find_element(By.XPATH,
        #                              mainPage_ObjectSearch_Column_settings_click_OK_Button_posXpath).click()  # 点击OK按钮
        # 公共方法 Detail特殊,需要使用时特殊提取
        # ID
        # self.key11 = self.driver.find_element(By.XPATH, Userdefined_first_row_first_column_posXpath).text
        # self.value12 = self.driver.find_element(By.XPATH, Userdefined_second_row_first_column_posXpath).text
        # # Vsy_ID
        # self.key12 = self.driver.find_element(By.XPATH, Userdefined_first_row_second_column_posXpath).text
        # self.value22 = self.driver.find_element(By.XPATH, Userdefined_second_row_second_column_posXpath).text
        # Name
        column_setting_btn = self.driver.find_element(By.XPATH,
                                                      mainPage_ObjectSearch_Column_settings_posXpath)  # 列设置按钮
        self.driver.execute_script("arguments[0].scrollIntoView();", column_setting_btn)
        column_setting_btn.click()
        self.driver.find_element(By.XPATH, '//span[text()="UUID"]').click()
        self.driver.find_element(By.XPATH, '//div[text()="Attribute Name"]').click()
        self.uuid_name = self.driver.find_element(By.XPATH, '//div[text()="UUID"]').text
        self.uuid_value = self.driver.find_element(By.XPATH, '//div[@aria-rowindex="2"]//div[@data-field="uuid"]').text

        self.key13 = self.driver.find_element(By.XPATH, Userdefined_first_row_third_column_posXpath).text
        self.value23 = self.driver.find_element(By.XPATH, Userdefined_second_row_third_column_posXpath).text
        # 字典
        self.table_dict1 = {self.uuid_name:self.uuid_value,self.key13: self.value23}
        print(self.table_dict1)

    # 提取Attributes的ID、Name
    def assert_ele_userdefined_attributes_and_signatures(self):
        # 公共方法 Detail特殊,需要使用时特殊提取
        # ID
        # self.key11 = self.driver.find_element(By.XPATH, Userdefined_first_row_first_column_posXpath).text
        # self.value12 = self.driver.find_element(By.XPATH, Userdefined_second_row_first_column_posXpath).text
        # # Vsy_ID
        # self.key12 = self.driver.find_element(By.XPATH, Userdefined_first_row_second_column_posXpath).text
        # self.value22 = self.driver.find_element(By.XPATH, Userdefined_second_row_second_column_posXpath).text
        # Name
        self.key13 = self.driver.find_element(By.XPATH, Userdefined_first_row_third_column_posXpath).text
        self.value23 = self.driver.find_element(By.XPATH, Userdefined_second_row_third_column_posXpath).text
        # 字典
        self.edit_table_dict1 = {self.key13: self.value23}
        print(self.edit_table_dict1)

    def new_security_policy(self, data: {}):
        # 跳转到安全策略创建页面
        self.driver.find_element(By.ID, mainPage_firstLevelMenu_Policy_posId).click()
        self.driver.find_element(By.ID, mainPage_secondLevelMenu_Security_posId).click()
        # 1、点击创建 2、输入Name 3、选择IMSI\IMEI\Phone_Number
        self.driver.find_element(By.XPATH, listpage_create_button_posXpath).click()
        self.driver.find_element(By.XPATH, security_create_Name_input_frame_PosXpath).send_keys(data['Name'])

        self.driver.find_element(By.XPATH, security_policy_add_condition_button_by_xpath).click()  # 选择Condition按钮
        self.driver.find_element(By.XPATH, security_policy_add_device_button_by_xpath).click()  # 选择Device
        self.driver.find_element(By.XPATH, security_policy_add_button_by_xpath).click()  # 添加Device
        if data["Createtype"] == "IMSI":
            self.driver.find_element(By.XPATH, security_create_add_source_button_select_IMSI_PosXpath).click()
            self.driver.find_element(By.XPATH, security_create_add_source_button_IMSI_search_frame_PosXpath).send_keys(
                data['Name'] + Keys.ENTER)
        elif data["Createtype"] == "Phone_Number":
            self.driver.find_element(By.XPATH, security_create_add_source_button_select_Phone_Number_PosXpath).click()
            self.driver.find_element(By.XPATH,
                                     security_create_add_source_button_Phone_Number_search_frame_PosXpath).send_keys(
                data['Name'] + Keys.ENTER)
        elif data["Createtype"] == "IMEI":
            self.driver.find_element(By.XPATH, security_create_add_source_button_select_IMEI_PosXpath).click()
            self.driver.find_element(By.XPATH, security_create_add_source_button_IMEI_search_frame_PosXpath).send_keys(
                data['Name'] + Keys.ENTER)
        time.sleep(3)
        self.driver.isElementExist(Element=security_create_add_source_button_select_first_object_PosXpath)
        if self.driver.Exist:  # 如果存在,就进行创建
            assert self.driver.Exist == True
            print('正常找到Object,正常进行引用创建')

            self.driver.find_element(By.XPATH, security_create_add_source_button_select_first_object_PosXpath).click()
            self.driver.find_element(By.XPATH, security_create_ok_click_posXpath).click()
            self.driver.find_element(By.XPATH, security_create_Warn_ok_click_posXpath).click()
        else:  # 不存在就跳过
            assert self.driver.Exist == False  # 未找到元素
            print('未找到Object,无法进行引用创建')
            pass

    def new_intercept_policy(self, data: {}):
        # 跳转到安全策略创建页面
        self.driver.find_element(By.ID, mainPage_firstLevelMenu_Policy_posId).click()
        self.driver.find_element(By.ID, mainPage_secondLevelMenu_Proxy_intercept_posId).click()
        # 1、点击创建 2、输入Name 3、选择IMSI\IMEI\Phone_Number
        self.driver.find_element(By.XPATH, intercept_create_Button_posXpath).click()
        self.driver.find_element(By.XPATH, intercept_create_Name_input_frame_PosXpath).send_keys(data['Name'])
        self.driver.find_element(By.XPATH, intercept_create_add_source_button_click_PosXpath).click()
        self.driver.find_element(By.XPATH, intercept_create_add_source_button_right_click_PosXpath).click()
        if data["Createtype"] == "IMSI":
            self.driver.find_element(By.XPATH, intercept_create_add_source_button_select_IMSI_PosXpath).click()
            self.driver.find_element(By.XPATH, intercept_create_add_source_button_IMSI_search_frame_PosXpath).send_keys(
                data['Name'] + Keys.ENTER)
        elif data["Createtype"] == "Phone_Number":
            self.driver.find_element(By.XPATH, intercept_create_add_source_button_select_Phone_Number_PosXpath).click()
            self.driver.find_element(By.XPATH,
                                     intercept_create_add_source_button_Phone_Number_search_frame_PosXpath).send_keys(
                data['Name'] + Keys.ENTER)
        elif data["Createtype"] == "IMEI":
            self.driver.find_element(By.XPATH, intercept_create_add_source_button_select_IMEI_PosXpath).click()
            self.driver.find_element(By.XPATH, intercept_create_add_source_button_IMEI_search_frame_PosXpath).send_keys(
                data['Name'] + Keys.ENTER)
        time.sleep(3)
        self.driver.isElementExist(Element=intercept_create_add_source_button_select_first_object_PosXpath)
        if self.driver.Exist:  # 如果存在,就进行创建
            assert self.driver.Exist == True
            print('正常找到Object,正常进行引用创建')
            self.driver.find_element(By.XPATH, intercept_create_add_source_button_select_first_object_PosXpath).click()
            # 添加application
            self.driver.find_element(By.XPATH, intercept_create_add_application__posXpath).click()
            self.driver.find_element(By.XPATH, intercept_create_application_select_first_http_posXpath).click()
            # 确认创建
            self.driver.find_element(By.XPATH, intercept_create_ok_click_posXpath).click()
            self.driver.find_element(By.XPATH, intercept_create_Warn_ok_click_posXpath).click()
        else:  # 不存在就跳过
            assert self.driver.Exist == False
            print('未找到Object,无法进行引用创建')
            pass

    def _del_policy(self, data: {}):
        if data['delete_mode'] == "security":
            # 跳转到安全策略创建页面
            self.driver.find_element(By.XPATH, mainPage_firstLevelMenu_Policy_posXpath).click()
            self.driver.find_element(By.XPATH, mainPage_secondLevelMenu_Security_posXpath).click()
            # 1、点击安全策略输入框 2、选择Name 3、输入Name 4、点击搜索 5、选择第一个元素 6、点击删除
            self.driver.find_element(By.XPATH, listpage_search_input_posXpath).click()
            self.driver.find_element(By.XPATH, listpage_search_input_posXpath).send_keys(data['Name'])
            self.driver.find_element(By.XPATH, listPage_objectSearch_select_Name_posXpath).click()
            self.driver.find_element(By.XPATH, listpage_search_button_posXpath).click()
            self.driver.isElementExist(Element=list_security_select_first_element_posXpath)
            if self.driver.Exist:  # 如果存在,就进行创建
                time.sleep(2)
                self.driver.find_element(By.XPATH, listPage_select_first_object_posXpath).click()
                self.driver.find_element(By.XPATH, listpage_delete_button_posXpath).click()
                self.driver.find_element(By.XPATH, listpage_delete_yes_button_posXpath).click()
            else:
                assert self.driver.Exist == False  # 未找到元素
                print('未找到Object,无法删除')
                pass
        elif data['delete_mode'] == "intercept":
            # 跳转到安全策略创建页面
            self.driver.find_element(By.ID, mainPage_firstLevelMenu_Policy_posId).click()
            self.driver.find_element(By.ID, mainPage_secondLevelMenu_Proxy_intercept_posId).click()
            # 1、点击安全策略输入框 2、选择Name 3、输入Name 4、点击搜索 5、选择第一个元素 6、点击删除
            self.driver.find_element(By.XPATH, list_intercept_select_frame_click_posXpath).click()
            self.driver.find_element(By.XPATH, list_intercept_select_frame_Name_click_posXpath).click()
            self.driver.find_element(By.XPATH, list_intercept_select_frame_Name_input_posXpath).send_keys(data['Name'])
            self.driver.find_element(By.XPATH, list_intercept_select_frame_click_search_posXpath).click()
            self.driver.find_element(By.XPATH, list_intercept_select_first_element_posXpath).click()
            self.driver.find_element(By.XPATH, delete_intercept_delete_button_posXpath).click()
            self.driver.find_element(By.XPATH, delete_intercept_delete_confirm_button_posXpath).click()
        else:
            pass
        self.driver.isElementExist(Element=listpage_no_data_posXpath)
        time.sleep(3)
        self.del_content = self.driver.find_element(By.XPATH, listpage_no_data_posXpath).text
        time.sleep(2)
        assert self.driver.Exist, "断言策略是否删除成功,No Data"
        assert self.del_content == "No rows"

    def Export_different_types(self):
        try:
            time.sleep(3)
            self.driver.find_element(By.XPATH,
                                     mobileIdentitiesObjectPage_Export_Mobile_Identity_files_OK_Button_posXpath).click()
            self.driver.isElementExist(Element=mobileIdentitiesObjectPage_Export_Mobile_type_imsi_posXpath)  # imsi导出展示
            assert self.driver.Exist
            self.driver.isElementExist(
                Element=mobileIdentitiesObjectPage_Export_Mobile_type_phone_number_posXpath)  # imsi导出展示
            assert self.driver.Exist
            self.driver.isElementExist(Element=mobileIdentitiesObjectPage_Export_Mobile_type_imei_posXpath)  # imsi导出展示
            assert self.driver.Exist
            self.driver.find_element(By.XPATH, '//div/div[3]/span/button[2]').click()
            print("点击导出按钮,断言可以导出多个不同type类型 == Sucess")
        except:
            print("点击导出按钮,断言可以导出多个不同type类型 == Fail")

    '''
    data:{
        "vsys_opearte": {"step1": "super_Tvsys1->create", "step2": "super_Mvsys3->search"}, # 操作模式:可以引用本vsys方法操作
        "delete_mode":"intercept"   # 清理数据 清理模式 
        }
    '''

    def Switch_vsys(self, vsys_id):
        time.sleep(2)
        self.driver.find_element(By.XPATH, objects_element_position.mainPage_navigationBar_Menu_posXpath).click()
        try:
            self.driver.isElementExist(Element=mobile_Identities_Group_confirm_leave_posXpath)
            time.sleep(2)
            if self.driver.Exist:
                time.sleep(3)
                self.driver.find_element(By.XPATH, mobile_Identities_Group_confirm_leave_posXpath).click()
        except:
            pass
        time.sleep(2)
        if vsys_id == "Tvsys2":
            self.driver.find_element(By.XPATH, mainPage_navigationBar_Tvsys10_posXpath).click()
        elif vsys_id == "Mvsys2":
            self.driver.find_element(By.XPATH, test_mainPage_navigationBar_Mvsys2_Tvsys4_posXpath).click()
        elif vsys_id == "Tvsys3":
            self.driver.find_element(By.XPATH, test_mainPage_navigationBar_Tvsys3_posXpath).click()
        elif vsys_id == "super_Mvsys3":
            # print("切换为super_Mvsys3")
            self.driver.find_element(By.XPATH,
                                     objects_element_position.mainPage_navigationBar_Mvsys3_Tvsys5_posXpath).click()
            # print("切换为super_Mvsys3",objects_element_position.mainPage_navigationBar_Mvsys3_Tvsys5_posXpath)
        elif vsys_id == "super_Tvsys10":
            self.driver.find_element(By.XPATH, mainPage_navigationBar_super_Tvsys10_posXpath).click()
        elif vsys_id == "super_Tvsys3":
            self.driver.find_element(By.XPATH, mainPage_navigationBar_super_Tvsys3_posXpath).click()

    def Watch_list(self):
        self.extract_ele()
        # 清空watch列表页
        self.driver.find_element(By.XPATH, listPage_objectSearch_mobileIdentities_right_list_watch_posXpath).click()
        self.driver.find_element(By.XPATH,
                                 listPage_objectSearch_mobileIdentities_right_list_watch_object_posXpath).click()
        self.driver.find_element(By.XPATH,
                                 listPage_objectSearch_mobileIdentities_right_list_watch_select_all_posXpath).click()
        self.driver.find_element(By.XPATH,
                                 listPage_objectSearch_mobileIdentities_right_list_watch_select_clear_posXpath).click()
        # 添加watch列表页
        self.driver.find_element(By.XPATH, listPage_object_mobileIdentities_select_First_object_posXpath).click()
        self.driver.find_element(By.XPATH, listPage_objectSearch_mobileIdentities_add_watch_posXpath).click()
        # 查看watch_list
        time.sleep(3)
        self.watch_ID = self.driver.find_element(By.XPATH, '//ul/li[1]/div/label/span[2]/p[1]').text
        self.watch_Name = self.driver.find_element(By.XPATH, '//ul/li[1]/div/label/span[2]/p[2]').text
        assert self.table_dict["ID"] == self.watch_ID, "断言添加到watch列表中的ID是否正确"
        assert self.table_dict["Name"] == self.watch_Name, "断言添加到watch列表中的Name是否正确"

    @screenshot_on_failure
    def assert_del(self):
        time.sleep(3)
        self.driver.isElementExist(Element=listPage_object_mobileIdentities_select_First_object_posXpath)
        if self.driver.Exist == False:
            self.Page_Tips = self.driver.find_element(By.XPATH,
                                                      listPage_object_mobileIdentities_del_after_ele_posXpath).text
            try:
                assert self.Page_Tips == "No rows", "校验是否删除成功生效"
                print("未查询到该Object,该Object不存在,断言成功")
            except:
                print("仍然可以查询到Object,断言失败")
        else:
            pass

    def compare_vsys(self, vsys1, vsys2):
        # _query=1,则可查询、断言ID、Name、查看操作权限
        # _query=0,不可查询,del断言,引用断言
        if vsys1[0] == vsys2[0] == "T" and vsys1 != vsys2:  # T1  T2
            self._query = 0  # 不可查询
        elif vsys1[0] == vsys2[0] == "T" and vsys1 == vsys2:  # T1 == T1
            self._query = 1  # 相同vsys,可查询
        elif vsys1[0] == vsys2[0] == "M" and vsys1 == vsys2:  # M1 = M1
            self._query = 1  # 相同Mvsys,可查询
        elif vsys1[0] == "M" and vsys2[0] == "T":  # M1 T1
            self._query = 0  # Tvsys只能查看当前Vsys
        elif vsys1[0] == "T" and vsys2[0] == "M":  # T1 M1
            self._query = 0  # Mvsys没有supervisor权限,无法查看下层vsys
        elif vsys1[0] == vsys2[0] == "s" and vsys1[6] == vsys2[6] == "T" and vsys1 != vsys2:  # ST1  ST2
            self._query = 0  # 不可查询
        elif vsys1[0] == vsys2[0] == "s" and vsys1[6] == vsys2[6] == "T" and vsys1 == vsys2:  # ST1  ST1
            self._query = 1  # 可查询
        elif vsys1[0] == vsys2[0] == "s" and vsys1[6] == "M" and vsys2[6] == "T":  # SM1  ST2
            self._query = 0  # 不可查询
        elif vsys1[0] == vsys2[0] == "s" and vsys1[6] == "T" and vsys2[6] == "M":  # ST1  SM2
            self._query = 1  # 可查询、断言ID、Name、查看操作权限
        else:
            pass

    # 没有编辑权限
    def Unauthorized_operation(self):
        self.driver.find_element(By.XPATH, listPage_object_mobileIdentities_allButton_posId).click()
        # 1、导出按钮置灰
        try:
            self.driver.isElementExist(
                Element=mobileIdentitiesObjectPage_Export_Mobile_Identity_Button_posXpath)  # 导出按钮置灰
            assert self.driver.Exist, "导出按钮置灰"
            print("导出按钮置灰,测试 == Success")
        except:
            print("导出按钮置灰,测试 == Fail")
        # 2、编辑按钮置灰
        try:
            self.driver.isElementExist(
                Element=mobileIdentitiesObjectPage_Edit_Mobile_Identity_Button_posXpath)  # 编辑按钮置灰
            assert self.driver.Exist, "编辑按钮置灰"
            print("编辑按钮置灰,测试 == Success")
        except:
            print("编辑按钮置灰,测试 == Fail")
        # 3、删除按钮置灰
        try:
            self.driver.isElementExist(
                Element=mobileIdentitiesObjectPage_Delete_Mobile_Identity_Button_posXpath)  # 删除按钮置灰
            assert self.driver.Exist, "删除按钮置灰"
            print("删除按钮置灰,测试 == Success")
        except:
            print("删除按钮置灰,测试 == Fail")

    # 刷新、翻页后元素不为选中状态
    def Clear_selection(self):
        try:
            self.driver.find_element(By.XPATH, listPage_object_mobileIdentities_allButton_posId).click()  # 选择all
            time.sleep(5)
            self.driver.find_element(By.ID, mainPage_secondLevelMenu_Mobile_Identities_posId).click()  # 刷新
            self.driver.isElementExist(Element=mobileIdentitiesObjectPage_selete_Mobile_Identity_Button_posXpath)
            time.sleep(5)
            assert self.driver.Exist, "刷新导致元素不勾选"
            print("刷新后元素不勾选,测试 == Success")
            time.sleep(5)
            self.driver.find_element(By.XPATH, listPage_object_mobileIdentities_allButton_posId).click()  # 选择all
            self.driver.find_element(By.XPATH, listPage_object_pages_nextPage_button_poxXpath).click()  # 第二页
            self.driver.isElementExist(Element=mobileIdentitiesObjectPage_selete_Mobile_Identity_Button_posXpath)
            time.sleep(5)
            assert self.driver.Exist, "翻页导致元素不勾选"
            print("翻页后元素不勾选,测试 == Success")
        except:
            print("翻页后元素不勾选,测试 == Fail")

    def Unable_to_upload(self):
        try:
            # 选择创建1
            self.driver.find_element(By.ID, listPage_object_mobileIdentities_createButton_posXpath).click()
            self.driver.find_element(By.ID,
                                     listPage_object_mobileIdentities_create_Mobile_Identity_Button_posId).click()
            self.driver.find_element(By.ID, mainPage_ObjectSearch_buttonAddItem_posId).click()
            time.sleep(3)
            self.driver.isElementExist(Element=mobileIdentitiesObjectPage_import_files_Mobile_Identity_Button_posXpath)
            assert self.driver.Exist
            print("导入按钮置灰,测试 == Success")
        except:
            print("导入按钮未置灰,测试 == Fail")

    def download_delete_import_files(self, data: {}):
        try:
            # 选择创建1
            self.driver.find_element(By.ID, listPage_object_mobileIdentities_createButton_posXpath).click()
            self.driver.find_element(By.ID,
                                     listPage_object_mobileIdentities_create_Mobile_Identity_Button_posId).click()
            # 上传文件
            self.driver.find_element(By.XPATH,
                                     mobileIdentitiesObjectPage_Button_Import_Mobile_Identity_files_posXpath).click()
            self.driver.find_element(By.XPATH,
                                     mobileIdentitiesObjectPage_Input_path_Import_Mobile_Identity_files_posXpath).send_keys(
                self.my_files._obj_files_path(file_name=data["files_name"]))
            self.driver.find_element(By.XPATH,
                                     mobileIdentitiesObjectPage_Import_Mobile_Identity_files_OK_Button_posXpath).click()
            self.driver.isElementExist(Element='//li/i[@class="iconfont icon-DownNormal fontsize16"]')
            assert self.driver.Exist
            print("存在下载按钮,测试 == Success")
            self.driver.isElementExist(Element='//li/i[@class="el-icon-close fontsize18"]')
            assert self.driver.Exist
            print("存在删除按钮,测试 == Success")
        except:
            print("测试失败,不存在下载、删除按钮")

    def switch_checked(self):
        # 选择创建2 Group
        self.driver.find_element(By.ID, listPage_object_mobileIdentities_createButton_posXpath).click()
        self.driver.find_element(By.ID,
                                 listPage_object_mobileIdentities_create_Mobile_Identity_Group_Button_posId).click()
        # 查看可以开启Exclude/Include开关
        self.driver.isElementExist(
            Element=mobileIdentitiesObjectPage_Exclude_Objects_close_Mobile_Identity_Button_posXpath)
        if self.driver.Exist:
            print("Exclude_Objects按钮开关为关,测试 == Success")
        else:
            print("Exclude_Objects按钮开关为开,测试 == Fail")
        # 查看可以开启Exclude/Include开关
        self.driver.find_element(By.XPATH,
                                 mobileIdentitiesObjectPage_Exclude_Objects_operation_Mobile_Identity_Button_posXpath).click()
        self.driver.isElementExist(
            Element=mobileIdentitiesObjectPage_Exclude_Objects_open_Mobile_Identity_Button_posXpath)
        if self.driver.Exist:
            print("Exclude_Objects按钮开关为关,测试 == Success")
        else:
            print("Exclude_Objects按钮开关为开,测试 == Fail")

    def random_object_statistics(self):
        random_object_statistic = random.choice(["Elaborate", "Brief", "None"])
        print(random_object_statistic)
        return random_object_statistic

    def linkdata(self, link_list_dict, port_listpage_linkButton_posId,
                 port_listpage_linkSave_posXpath,
                 port_listpage_linkAdd_posXpath,
                 port_listpage_linkOk_posXpath):
        """
        :param link_dict:  [{"link_dst_cluster": "42.49-User4Link", "link_dst_vsys":"Vsys2test"}]
        :param link_dst_cluster:
        :param link_dst_vsys:
        :return:
        """
        # 点击 link 按钮
        # {"link_dst_cluster": "42.49-User4Link", "link_dst_vsys":"Vsys2test"}
        # link_dst_cluster = link_dict["link_dst_cluster"]
        # link_dst_vsys = link_dict["Vsys2test"]
        self.driver.find_element(By.ID, port_listpage_linkButton_posId).click()
        link_count = len(link_list_dict)
        for link_index in range(len(link_list_dict)):
            link_dst_cluster = link_list_dict[link_index]["link_dst_cluster"]
            link_dst_vsys = link_list_dict[link_index]["link_dst_vsys"]
            # 选择cluster
            self.driver.find_element(By.XPATH, port_listPage_linkTips_input_clusterSelect_posXpath).click()
            el_cluster_path = port_listPage_linkTips_dropitem_clusterDrop_posXpath.format(replaceName=link_dst_cluster)
            # 下拉列表元素移动到页面显示,在执行js强制点击
            actions = ActionChains(self.driver)
            element_item = self.driver.find_element(By.XPATH, el_cluster_path)
            actions.move_to_element(element_item).perform()
            self.driver.execute_script("arguments[0].click();", element_item)
            # 选择vsys id
            self.driver.find_element(By.XPATH, port_listPage_linkTips_input_vsysSelect_posXpath).click()
            el_vsys_path = port_listPage_linkTips_dropitem_vsysSelect_posXpath.format(replaceName=link_dst_vsys)
            # 下拉列表元素移动到页面显示,在执行js强制点击
            element_item2 = self.driver.find_element(By.XPATH, el_vsys_path)
            actions.move_to_element(element_item2).perform()
            self.driver.execute_script("arguments[0].click();", element_item2)
            # 点击 保存
            if link_index == 0:
                self.driver.find_element(By.XPATH, port_listpage_linkSave_posXpath).click()
            else:
                self.driver.find_element(By.XPATH, "//*[@id='clusterSave']/i").click()
            if link_index != link_count - 1:  # 不是最后一个cluster 需要添加添加按钮
                self.driver.find_element(By.XPATH, port_listpage_linkAdd_posXpath).click()
        # 点击 OK
        self.driver.find_element(By.XPATH, port_listpage_linkOk_posXpath).click()
        time.sleep(3)
        # 状态断言
        status_info = "color: rgb(141, 203, 75);"
        rows = self.driver.find_element(By.XPATH, port_listPage_objectTable_tableTbody_posXpath).find_elements(By.XPATH,
                                                                                                               "./tr")
        print(len(rows))
        for row_0 in rows:
            status_style = row_0.find_element(By.XPATH, "./td[7]//i").get_attribute("style")
            print(status_style)
            pytest_check.is_in(status_info, status_style, msg="所在行数{}".format(inspect.currentframe().f_lineno))
        time.sleep(1)
        self.driver.isElementExist(
            Element='((//div[@class!="itemDetails cursor"]//table[@class="el-table__body"])[1]//tr)[1]')  # 查看第一行是否存在数据
        if self.driver.Exist:
            # 展示所有列
            self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_posXpath).click()  # 点击列设置
            all_checked_xpath = '//*[@class="all-btn"]//*[@class="el-checkbox__input is-checked"]'
            if self.driver.element_isExist(By.XPATH, all_checked_xpath):  # 如果全选被选中
                self.driver.find_element(By.XPATH,
                                         mainPage_ObjectSearch_Column_settings_click_Cancel_Button_posXpath).click()  # 点击Cancel按钮
            else:
                self.driver.find_element(By.XPATH,
                                         mainPage_ObjectSearch_Column_settings_select_allCheckBox_posXpath).click()  # 全选
                self.driver.find_element(By.XPATH,
                                         mainPage_ObjectSearch_Column_settings_click_OK_Button_posXpath).click()  # 点击OK按
        Des_ID_list = []
        # 获取所有Dst ID
        Dst_IDs = self.driver.find_elements(By.XPATH,
                                            "//div[contains(@class,'el-table__body-wrapper')]//tr//td[count(//div[@class='el-table__header-wrapper']//span[text()='Destination ID']/../../../preceding-sibling::th)+1]//span")
        for Dst_ID in Dst_IDs:
            Des_ID_list.append(Dst_ID.text)
        print(Des_ID_list)
        # 获取Request_ID
        Request_ID = self.driver.find_element(By.XPATH,
                                              "//div[contains(@class,'el-table__body-wrapper')]//tr[1]//td[count(//div[@class='el-table__header-wrapper']//span[text()='Request ID']/../../../preceding-sibling::th)+1]//span").text
        return Des_ID_list, Request_ID

    def _linkdata(self, link_list_dict, port_listpage_linkButton_posId,
                  port_listpage_linkSave_posXpath,
                  port_listpage_linkAdd_posXpath,
                  port_listpage_linkOk_posXpath):
        """
        :param link_dict:  [{"link_dst_cluster": "42.49-User4Link", "link_dst_vsys":"Vsys2test"}]
        :param link_dst_cluster:
        :param link_dst_vsys:
        :return:
        """
        # 点击 link 按钮
        # {"link_dst_cluster": "42.49-User4Link", "link_dst_vsys":"Vsys2test"}
        # link_dst_cluster = link_dict["link_dst_cluster"]
        # link_dst_vsys = link_dict["Vsys2test"]
        self.driver.find_element(By.ID, port_listpage_linkButton_posId).click()
        link_count = len(link_list_dict)
        for link_index in range(len(link_list_dict)):
            link_dst_cluster = link_list_dict[link_index]["link_dst_cluster"]
            link_dst_vsys = link_list_dict[link_index]["link_dst_vsys"]
            # 选择cluster
            self.driver.find_element(By.XPATH, port_listPage_linkTips_input_clusterSelect_posXpath).click()
            el_cluster_path = port_listPage_linkTips_dropitem_clusterDrop_posXpath.format(replaceName=link_dst_cluster)
            # 下拉列表元素移动到页面显示,在执行js强制点击
            actions = ActionChains(self.driver)
            element_item = self.driver.find_element(By.XPATH, el_cluster_path)
            actions.move_to_element(element_item).perform()
            self.driver.execute_script("arguments[0].click();", element_item)
            # 选择vsys id
            self.driver.find_element(By.XPATH, port_listPage_linkTips_input_vsysSelect_posXpath).click()
            el_vsys_path = port_listPage_linkTips_dropitem_vsysSelect_posXpath.format(replaceName=link_dst_vsys)
            # 下拉列表元素移动到页面显示,在执行js强制点击
            element_item2 = self.driver.find_element(By.XPATH, el_vsys_path)
            # actions.move_to_element(element_item2).perform()
            # self.driver.execute_script("arguments[0].click();", element_item2)
            self.driver.execute_script("arguments[0].scrollIntoView();", element_item2)
            element_item2.click()
            # 点击 保存
            if link_index == 0:
                self.driver.find_element(By.XPATH, port_listpage_linkSave_posXpath).click()
            else:
                self.driver.find_element(By.XPATH, "//*[@id='clusterSave']/i").click()
            if link_index != link_count - 1:  # 不是最后一个cluster 需要添加添加按钮
                self.driver.find_element(By.XPATH, port_listpage_linkAdd_posXpath).click()
        # 点击 OK
        self.driver.find_element(By.XPATH, port_listpage_linkOk_posXpath).click()
        time.sleep(3)
        # 状态断言
        status_info = "color: rgb(141, 203, 75);"
        rows = self.driver.find_element(By.XPATH, port_listPage_objectTable_tableTbody_posXpath).find_elements(By.XPATH,
                                                                                                               "./tr")
        print(len(rows))
        for row_0 in rows:
            status_style = row_0.find_element(By.XPATH, "./td[7]//i").get_attribute("style")
            print(status_style)
            pytest_check.is_in(status_info, status_style, msg="所在行数{}".format(inspect.currentframe().f_lineno))
        time.sleep(1)
        self.driver.isElementExist(
            Element='((//div[@class!="itemDetails cursor"]//table[@class="el-table__body"])[1]//tr)[1]')  # 查看第一行是否存在数据
        if self.driver.Exist:
            # 展示所有列
            self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_posXpath).click()  # 点击列设置
            time.sleep(1)
            all_checked_xpath = '//*[@class="all-btn"]//*[@class="el-checkbox__input is-checked"]'
            if self.driver.element_isExist(By.XPATH, all_checked_xpath):  # 如果全选被选中
                time.sleep(1)
                self.driver.find_element(By.XPATH,
                                         mainPage_ObjectSearch_Column_settings_click_Cancel_Button_posXpath).click()  # 点击Cancel按钮
            else:
                time.sleep(1)
                self.driver.find_element(By.XPATH,
                                         mainPage_ObjectSearch_Column_settings_select_allCheckBox_posXpath).click()  # 全选
                time.sleep(1)
                self.driver.find_element(By.XPATH,
                                         mainPage_ObjectSearch_Column_settings_click_OK_Button_posXpath).click()  # 点击OK按钮
        Des_ID_list = []
        Sou_ID_list = []
        Sou_IDS = self.driver.find_elements(By.XPATH,
                                            "//div[contains(@class,'el-table__body-wrapper')]//tr//td[count(//div[@class='el-table__header-wrapper']//span[text()='Source ID']/../../../preceding-sibling::th)+1]//span[@class='table-hide']")
        for Sou_ID in Sou_IDS:
            Sou_ID_list.append(Sou_ID.text)
        print(Sou_ID_list)
        # 获取所有Dst ID
        Dst_IDs = self.driver.find_elements(By.XPATH,
                                            "//div[contains(@class,'el-table__body-wrapper')]//tr//td[count(//div[@class='el-table__header-wrapper']//span[text()='Destination ID']/../../../preceding-sibling::th)+1]//span")
        for Dst_ID in Dst_IDs:
            Des_ID_list.append(Dst_ID.text)
        print(Des_ID_list)
        # 获取Request_ID
        Request_ID = self.driver.find_element(By.XPATH,
                                              "//div[contains(@class,'el-table__body-wrapper')]//tr[1]//td[count(//div[@class='el-table__header-wrapper']//span[text()='Request ID']/../../../preceding-sibling::th)+1]//span").text
        return Des_ID_list, Request_ID, Sou_ID_list

    def _del_policy_links(self, Request_ID):
        username = self.driver.find_element(By.XPATH, '//*[@id="user_avator"]/span').text
        if username == "admin":
            loginout = LogInOut(self.driver)
            loginout.logout()
            time.sleep(1)
            loginout.login_other(url="http://192.168.44.72/#/login", username="guouitest", passwd="jMIfnvhc1U")
        else:
            pass
        # 跳转至Federation-Policy Links
        # 点击Menu按钮
        self.driver.find_element(By.CSS_SELECTOR, mainPage_button_menu_posXCss).click()
        # 点击Admin area
        self.driver.find_element(By.XPATH, mainPage_navigationBar_Menu_adminArea_posXpath).click()
        # 点击Federation
        self.driver.find_element(By.XPATH, mainPage_firstLevelMenu_federation_posXpath).click()
        # 点击policy links
        self.driver.find_element(By.XPATH, mainPage_secondLevelMenu_policy_link_posXpath).click()
        # 点击输入框
        self.driver.find_element(By.ID, mainPage_common_search_selectLabel_posId).click()
        # 选择查询方式为Request ID,输入Request ID
        self.driver.find_element(By.XPATH, federation_policy_link_drop_requestID_posXpath).click()
        self.driver.find_element(By.XPATH, federation_policy_link_input_value_posXpath).send_keys(Request_ID)
        # 点击搜索
        self.driver.find_element(By.ID, listPage_federation_policy_link_buttonSearch_posId).click()
        # 删除Policy Links记录
        self.driver.find_element(By.XPATH, federation_policy_link_all_select_posXpath).click()
        self.driver.find_element(By.ID, federation_policy_link_list_button_delete_posId).click()
        self.driver.find_element(By.XPATH, federation_policy_link_delete_yes_posXpath).click()
        # 校验no data文本
        self.driver.implicitly_wait(5)
        self.driver.isElementExist(Element=url_listPage_noDataText_posXpath)
        no_data_elem = self.driver.Exist
        print("No Data {}".format(no_data_elem))

    def click_sync(self, Request_ID):
        username = self.driver.find_element(By.XPATH, '//*[@id="user_avator"]/span').text
        if username == "admin":
            loginout = LogInOut(self.driver)
            loginout.logout()
            time.sleep(1)
            loginout.login_other(url="http://192.168.44.72/#/login", username="guouitest", passwd="jMIfnvhc1U")
        else:
            pass
        # 跳转至Federation-Policy Links
        # 点击Menu按钮
        self.driver.find_element(By.CSS_SELECTOR, mainPage_button_menu_posXCss).click()
        # 点击Admin area
        self.driver.find_element(By.XPATH, mainPage_navigationBar_Menu_adminArea_posXpath).click()
        # 点击Federation
        self.driver.find_element(By.XPATH, mainPage_firstLevelMenu_federation_posXpath).click()
        # 点击policy links
        self.driver.find_element(By.XPATH, mainPage_secondLevelMenu_policy_link_posXpath).click()
        # 点击输入框
        self.driver.find_element(By.ID, mainPage_common_search_selectLabel_posId).click()
        # 选择查询方式为Request ID,输入Request ID
        self.driver.find_element(By.XPATH, federation_policy_link_drop_requestID_posXpath).click()
        time.sleep(1)
        self.driver.find_element(By.XPATH, federation_policy_link_input_value_posXpath).send_keys(Request_ID)
        # 点击搜索
        self.driver.find_element(By.ID, listPage_federation_policy_link_buttonSearch_posId).click()
        time.sleep(1)
        ele = self.driver.find_element(By.XPATH, federation_policy_link_list_first_button_sync_posId)
        # self.driver.execute_script("arguments[0].style.zIndex = '999'", ele)
        ele.click()
        # self.driver.execute_script("arguments[0].click()", ele)
        time.sleep(1)
        self.driver.isElementExist(
            Element='((//div[@class!="itemDetails cursor"]//table[@class="el-table__body"])[1]//tr)[1]')  # 查看第一行是否存在数据
        time.sleep(1)
        if self.driver.Exist:
            # 展示所有列
            self.driver.find_element(By.XPATH, mainPage_ObjectSearch_Column_settings_posXpath).click()  # 点击列设置
            all_checked_xpath = '//*[@class="all-btn"]//*[@class="el-checkbox__input is-checked"]'
            if self.driver.element_isExist(By.XPATH, all_checked_xpath):  # 如果全选被选中
                time.sleep(1)
                self.driver.find_element(By.XPATH,
                                         mainPage_ObjectSearch_Column_settings_click_Cancel_Button_posXpath).click()  # 点击Cancel按钮
            else:
                self.driver.find_element(By.XPATH,
                                         mainPage_ObjectSearch_Column_settings_select_allCheckBox_posXpath).click()  # 全选
                self.driver.find_element(By.XPATH,
                                         mainPage_ObjectSearch_Column_settings_click_OK_Button_posXpath).click()  # 点击OK按钮
        time.sleep(1)
        Request_ID = self.driver.find_element(By.XPATH,
                                              "//div[contains(@class,'el-table__body-wrapper')]//tr[1]//td[count(//div[@class='el-table__header-wrapper']//span[text()='Request ID']/../../../preceding-sibling::th)+1]//span").text
        return Request_ID

    def only_linkdata(self, link_list_dict, port_listpage_linkButton_posId,
                      port_listpage_linkSave_posXpath,
                      port_listpage_linkAdd_posXpath,
                      port_listpage_linkOk_posXpath):
        """
        :param link_dict:  [{"link_dst_cluster": "42.49-User4Link", "link_dst_vsys":"Vsys2test"}]
        :param link_dst_cluster:
        :param link_dst_vsys:
        :return:
        """
        # 点击 link 按钮
        # {"link_dst_cluster": "42.49-User4Link", "link_dst_vsys":"Vsys2test"}
        # link_dst_cluster = link_dict["link_dst_cluster"]
        # link_dst_vsys = link_dict["Vsys2test"]
        self.driver.find_element(By.ID, port_listpage_linkButton_posId).click()
        link_count = len(link_list_dict)
        for link_index in range(len(link_list_dict)):
            link_dst_cluster = link_list_dict[link_index]["link_dst_cluster"]
            link_dst_vsys = link_list_dict[link_index]["link_dst_vsys"]
            # 选择cluster
            self.driver.find_element(By.XPATH, port_listPage_linkTips_input_clusterSelect_posXpath).click()
            el_cluster_path = port_listPage_linkTips_dropitem_clusterDrop_posXpath.format(replaceName=link_dst_cluster)
            # 下拉列表元素移动到页面显示,在执行js强制点击
            actions = ActionChains(self.driver)
            element_item = self.driver.find_element(By.XPATH, el_cluster_path)
            actions.move_to_element(element_item).perform()
            self.driver.execute_script("arguments[0].click();", element_item)
            # 选择vsys id
            self.driver.find_element(By.XPATH, port_listPage_linkTips_input_vsysSelect_posXpath).click()
            el_vsys_path = port_listPage_linkTips_dropitem_vsysSelect_posXpath.format(replaceName=link_dst_vsys)
            # 下拉列表元素移动到页面显示,在执行js强制点击
            element_item2 = self.driver.find_element(By.XPATH, el_vsys_path)
            # actions.move_to_element(element_item2).perform()
            # self.driver.execute_script("arguments[0].click();", element_item2)
            self.driver.execute_script("arguments[0].scrollIntoView();", element_item2)
            element_item2.click()
            # 点击 保存
            if link_index == 0:
                self.driver.find_element(By.XPATH, port_listpage_linkSave_posXpath).click()
            else:
                self.driver.find_element(By.XPATH, "//*[@id='clusterSave']/i").click()
            if link_index != link_count - 1:  # 不是最后一个cluster 需要添加添加按钮
                self.driver.find_element(By.XPATH, port_listpage_linkAdd_posXpath).click()
        # 点击 OK
        self.driver.find_element(By.XPATH, port_listpage_linkOk_posXpath).click()
        time.sleep(3)
        # 状态断言
        status_info = "color: rgb(141, 203, 75);"
        rows = self.driver.find_element(By.XPATH, port_listPage_objectTable_tableTbody_posXpath).find_elements(By.XPATH,
                                                                                                               "./tr")
        print(len(rows))
        for row_0 in rows:
            status_style = row_0.find_element(By.XPATH, "./td[7]//i").get_attribute("style")
            print(status_style)
            pytest_check.is_in(status_info, status_style, msg="所在行数{}".format(inspect.currentframe().f_lineno))

        Des_ID_list = []
        Sou_ID_list = []
        # 获取所有Sou ID
        Sou_IDS = self.driver.find_elements(By.XPATH,
                                            "//div[contains(@class,'el-table__body-wrapper')]//tr//td[count(//div[@class='el-table__header-wrapper']//span[text()='Source ID']/../../../preceding-sibling::th)+1]//span")
        for Sou_ID in Sou_IDS:
            Sou_ID_list.append(Sou_ID.text)
        print(Sou_ID_list)
        # 获取所有Dst ID
        Dst_IDs = self.driver.find_elements(By.XPATH,
                                            "//div[contains(@class,'el-table__body-wrapper')]//tr//td[count(//div[@class='el-table__header-wrapper']//span[text()='Destination ID']/../../../preceding-sibling::th)+1]//span")
        for Dst_ID in Dst_IDs:
            Des_ID_list.append(Dst_ID.text)
        # 删除policy links记录
        self.driver.find_element(By.XPATH, federation_policy_link_all_select_posXpath).click()
        self.driver.find_element(By.ID, federation_policy_link_list_button_delete_posId).click()
        self.driver.find_element(By.XPATH, federation_policy_link_delete_yes_posXpath).click()
        # 校验no data文本
        self.driver.implicitly_wait(5)
        self.driver.isElementExist(Element=url_listPage_noDataText_posXpath)
        no_data_elem = self.driver.Exist
        print("No Data {}".format(no_data_elem))
        return Sou_ID_list, Des_ID_list

    def screen_shot(self):
        formatted_time = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d-%H-%M-%S')
        file = "{}.png".format(formatted_time)
        file_path = os.path.join(workdir, "results", "screenshot", file)
        file_path_work = os.path.join(workdir, "results", "screenshot")
        if not os.path.exists(file_path_work):
            os.makedirs(file_path_work)
        if not os.path.exists(file_path):
            print(f"截图保存于:{file_path}")
            self.driver.save_screenshot(file_path)

    def different_vsys_check(self, obj_type, data):
        # vsys10中创建
        self.object_operation(obj_type, "create", data)
        # 切换Vsys至Vsys0
        self.profile_pub.change_vsys(vsys_name="vsys0")
        # 判断并处理data中必须唯的一字段
        data = self.opr_unique_fields(data)
        # vsys0中创建
        self.object_operation(obj_type, "create", data)
        # vsys_zero_object = self.extract_ele()
        try:
            # vsys0中查询
            self.object_operation(obj_type, "query", data)
            self.view_check("vsys0")
            # 切换Vsys至Vsys3
            self.profile_pub.change_vsys(vsys_name="PerformanceTestVsys")
            # vsys3中查询
            self.object_operation(obj_type, "query", data)
            self.view_check("PerformanceTestVsys")
            # 切换Vsys至Vsys10
            self.profile_pub.change_vsys(vsys_name="UIAutoTestVsys")
            # vsys10中查询
            self.object_operation(obj_type, "query", data)
            self.view_check("UIAutoTestVsys")
        except Exception as e:
            raise e
        finally:
            # 清理测试数据
            if obj_type == "tunnels":
                self.object_operation(obj_type, "delete_created_ip_bymself", data)
            # self.object_operation(obj_type, "delete", data)
            self.profile_pub.change_vsys(vsys_name="vsys0")
            self.object_operation(obj_type, "delete", data)

    def view_check(self, vsys_name):
        table_dict = self.extract_ele()
        time.sleep(1)
        total = self.driver.find_element(By.XPATH,
                                         "//div[@class='page-box-containcheck']//span[contains(text(),'Total')]").text
        count = total.split("Total:")
        if vsys_name == "PerformanceTestVsys":  # vsys3中仅可查看Vsys0中的数据,而无Vsys10的数据
            assert int(count[1]) == 1 and table_dict["Vsys ID"] == "0"
            # todo 需校验Vsys
        elif vsys_name == "vsys0":  # Vsys0中可查看Vsys0中的数据,与Vsys10的数据
            # abc = table_dict["Vsys ID"]
            assert int(count[1]) == 2 and table_dict["Vsys ID"] == "0", "校验失败!count={},VsysID={}".format(
                int(count[1]), table_dict["Vsys ID"])
            self.driver.find_element(By.XPATH,
                                     listPage_second_row_checkBox_posXpat).click()  # 选择第二行的checkbox(vsys10中创建的数据)
            self.driver.find_element(By.XPATH, listPage_viewButton_posXpath).click()  # 点击View按钮
            # 校验Vsys0下查看Vsys10的数据
            assert len(self.driver.find_elements(By.XPATH,
                                                 '//div[contains(@class,"IconBtn") and contains(@class," disabled-btn")]')) >= 3
            is_ok_exist = self.driver.element_isExist(By.XPATH, ObjectDetailPage_mainOkButton_poXpath)
            assert is_ok_exist == False
            self.driver.find_element(By.XPATH, ObjectDetailPage_mainCancelButton_poXpath).click()  # 点击Cancel 按钮
        elif vsys_name == "UIAutoTestVsys":  # Vsys10中可查看Vsys0中的数据,与Vsys10的数据
            try:
                assert int(count[1]) == 2 and table_dict["Vsys ID"] == "0"
                self.driver.find_element(By.XPATH,
                                         listPage_first_row_checkBox_posXpath).click()  # 选择第一行的checkbox(vsys0中创建的数据)
                self.driver.find_element(By.XPATH, listPage_viewButton_posXpath).click()  # 点击View按钮
                add_item_disable = self.driver.element_isExist(by=By.XPATH,
                                                               value='(//div[contains(@class,"IconBtn") and contains(@class," disabled-btn")])[1]')
                edit_item_disable = self.driver.element_isExist(by=By.XPATH,
                                                                value='(//div[contains(@class,"IconBtn") and contains(@class," disabled-btn")])[2]')
                del_item_disable = self.driver.element_isExist(by=By.XPATH,
                                                               value='(//div[contains(@class,"IconBtn") and contains(@class," disabled-btn")])[3]')
                assert add_item_disable == edit_item_disable == del_item_disable == True
                self.driver.isElementExist(ObjectDetailPage_mainOkButton_poXpath)
                assert self.driver.Exist == False
            except Exception as e:
                raise e
            finally:
                # 清理Vsys10中的测试数据
                self.driver.find_element(By.XPATH,
                                         ObjectDetailPage_mainCancelButton_poXpath).click()  # 点击Cancel 按钮返回列表页
                self.driver.find_element(By.XPATH,
                                         listPage_second_row_checkBox_posXpat).click()  # 选择第二行的checkbox(vsys10中创建的数据)
                self.driver.find_element(By.XPATH, listPage_deleteButton_posXpath).click()  # 点击Delete按钮
                self.driver.find_element(By.XPATH, listPage_object_FQDNs_del_yes_Button_posXpath).click()  # 删除确认弹窗中确认

    def attr_audit_log_check(self, type, operation):
        # 点击audit Logs
        self.driver.find_element(By.XPATH, '//*[@id="id"]//div[@class="audit_log"]/span').click()
        self.driver.find_element(By.XPATH,
                                 acc_ObjectDetailPage_auditLogsDrawer_firstRowLog_checkBox_posXpath).click()  # 勾选第一行log CheckBox
        self.driver.find_element(By.XPATH,
                                 acc_ObjectDetailPage_auditLogsDrawer_compareButton_posXpath).click()  # 点击compare 按钮
        source_ip = self.loginout_parse.get("remote_url", "url").replace("http://", "").split(":")[
            0]  # 获取字符串http://192.168.39.77:4444地址中的ip
        assert self.driver.find_element(By.XPATH,
                                        ObjectDetailPage_audit_log_compare_version_posXpath).text != "", "断言版本不为空"
        assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_id_posXpath).text == \
               self.table_dict1["ID"]
        assert self.driver.find_element(By.XPATH,
                                        url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath).text == operation
        assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_type_posXpath).text == type
        assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_ip_posXpath).text == source_ip
        assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_time_posXpath).text != ""
        assert self.loginout_parse.get("ui_account_1", "username") in self.driver.find_element(By.XPATH,
                                                                                               ObjectDetailPage_audit_log_compare_user_posXpath).text
        if operation == "Edit":
            self.driver.find_element(By.XPATH,
                                     '//*[@id="interceptionadd_allcancelobject10-_AuditLogs_anonymousComponent_Attribute_Home_App_anonymousComponent"]').click()
            self.driver.find_element(By.XPATH, '//*[@id="id"]//div[@class="audit_log"]/span').click()
            self.driver.find_element(By.XPATH,
                                     acc_ObjectDetailPage_auditLogsDrawer_firstRowLog_checkBox_posXpath).click()
            self.driver.find_element(By.XPATH,
                                     acc_ObjectDetailPage_auditLogsDrawer_firstRowLog_checkBox_posXpath).click()
            self.driver.find_element(By.XPATH,
                                     acc_ObjectDetailPage_auditLogsDrawer_compareButton_posXpath).click()  # 点击compare 按钮
            assert (self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_id_posXpath + "[1]").text
                    == self.driver.find_element(By.XPATH,
                                                ObjectDetailPage_audit_log_compare_id_posXpath + "[2]").text)
            assert (self.driver.find_element(By.XPATH,
                                             ObjectDetailPage_audit_log_compare_type_posXpath + "[1]").text
                    == self.driver.find_element(By.XPATH,
                                                ObjectDetailPage_audit_log_compare_type_posXpath + "[2]").text)
            assert (self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_ip_posXpath + "[1]").text
                    == self.driver.find_element(By.XPATH,
                                                ObjectDetailPage_audit_log_compare_ip_posXpath + "[2]").text)
            assert (self.driver.find_element(By.XPATH,
                                             ObjectDetailPage_audit_log_compare_user_posXpath + "[1]").text
                    == self.driver.find_element(By.XPATH,
                                                ObjectDetailPage_audit_log_compare_user_posXpath + "[2]").text)
            assert self.driver.find_element(By.XPATH,
                                            url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath + "[1]").text == "Create"
            assert self.driver.find_element(By.XPATH,
                                            url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath + "[2]").text == "Edit"

    def sign_audit_log_check(self, type, operation):
        # 点击audit Logs
        self.driver.find_element(By.XPATH, '//*[@id="router-view-container"]//div[@class="audit_log"]/span').click()
        self.driver.find_element(By.XPATH,
                                 acc_ObjectDetailPage_auditLogsDrawer_firstRowLog_checkBox_posXpath).click()  # 勾选第一行log CheckBox
        self.driver.find_element(By.XPATH,
                                 acc_ObjectDetailPage_auditLogsDrawer_compareButton_posXpath).click()  # 点击compare 按钮
        source_ip = self.loginout_parse.get("remote_url", "url").replace("http://", "").split(":")[
            0]  # 获取字符串http://192.168.39.77:4444地址中的ip
        assert self.driver.find_element(By.XPATH,
                                        ObjectDetailPage_audit_log_compare_version_posXpath).text != "", "断言版本不为空"
        assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_id_posXpath).text == \
               self.table_dict1["ID"]
        assert self.driver.find_element(By.XPATH,
                                        url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath).text == operation
        assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_type_posXpath).text == type
        assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_ip_posXpath).text == source_ip
        assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_time_posXpath).text != ""
        assert self.loginout_parse.get("ui_account_1", "username") in self.driver.find_element(By.XPATH,
                                                                                               ObjectDetailPage_audit_log_compare_user_posXpath).text
        if operation == "Edit":
            self.driver.find_element(By.XPATH,
                                     '//*[@id="interceptionadd_allcancelobject10-_AuditLogs_anonymousComponent_VPanel_VEditPanel_ApplicationSignaturesAdd_Home_App_anonymousComponent"]').click()
            self.driver.find_element(By.XPATH, '//*[@id="router-view-container"]//div[@class="audit_log"]/span').click()
            self.driver.find_element(By.XPATH,
                                     acc_ObjectDetailPage_auditLogsDrawer_firstRowLog_checkBox_posXpath).click()
            self.driver.find_element(By.XPATH,
                                     acc_ObjectDetailPage_auditLogsDrawer_firstRowLog_checkBox_posXpath).click()
            self.driver.find_element(By.XPATH,
                                     acc_ObjectDetailPage_auditLogsDrawer_compareButton_posXpath).click()  # 点击compare 按钮
            assert (self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_id_posXpath + "[1]").text
                    == self.driver.find_element(By.XPATH,
                                                ObjectDetailPage_audit_log_compare_id_posXpath + "[2]").text)
            assert (self.driver.find_element(By.XPATH,
                                             ObjectDetailPage_audit_log_compare_type_posXpath + "[1]").text
                    == self.driver.find_element(By.XPATH,
                                                ObjectDetailPage_audit_log_compare_type_posXpath + "[2]").text)
            assert (self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_ip_posXpath + "[1]").text
                    == self.driver.find_element(By.XPATH,
                                                ObjectDetailPage_audit_log_compare_ip_posXpath + "[2]").text)
            assert (self.driver.find_element(By.XPATH,
                                             ObjectDetailPage_audit_log_compare_user_posXpath + "[1]").text
                    == self.driver.find_element(By.XPATH,
                                                ObjectDetailPage_audit_log_compare_user_posXpath + "[2]").text)
            assert self.driver.find_element(By.XPATH,
                                            url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath + "[1]").text == "Create"
            assert self.driver.find_element(By.XPATH,
                                            url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath + "[2]").text == "Edit"

    def opr_unique_fields(self, data):
        # ASN不可重复
        try:
            data_asn = data["ASN"]
            if data_asn or data_asn == '':  # 存在ans
                data_asn = self.my_random.random_asn()
            data["ASN"] = data_asn
        except:
            pass
        # # 其他条件
        # try:
        #     pass
        # except:
        #     pass
        return data

    def audit_log_view(self, object_type, import_verify=1, export_verify=1):
        user_name = self.loginout_parse.get("ui_account_1", "username")
        self.driver.find_element(By.XPATH, mainPage_firstLevelMenu_System_posXpath).click()
        self.driver.find_element(By.XPATH, mainPage_secondLevelMenu_auditLogs_posXpath).click()
        time.sleep(3)
        self.driver.find_element(By.XPATH, listPage_auditlogSearch_input_posXpath).click()
        ###校验["Create", "Edit", "Delete", "Import", "Query Verbose"]
        # 选择Targrt ID
        if object_type in ["Signature", "Application", "Attribute"]:
            self.driver.find_element(By.XPATH, listPage_auditlogSearch_input_posXpath).send_keys(self.table_dict1["UUID"] + Keys.ENTER)
            self.driver.find_element(By.XPATH, listPage_auditlogSearch_select_TagrgetID_posXpath).click()
        else:
            self.driver.find_element(By.XPATH, listPage_auditlogSearch_input_posXpath).send_keys(self.table_dict["UUID"] + Keys.ENTER)
            self.driver.find_element(By.XPATH, listPage_auditlogSearch_select_TagrgetID_posXpath).click()
        # 选择Target Type
        self.driver.find_element(By.XPATH, listPage_auditlogSearch_input_posXpath).click()
        self.driver.find_element(By.XPATH, listPage_auditlogSearch_select_TargetType_posXpath).click()
        scrollable_div = self.driver.find_element(By.XPATH,f"//ul[@class='base-Popper-root MuiSelect-listbox Mui-expanded css-1wd16dk']//li[text()='{object_type}']")
        self.driver.execute_script("arguments[0].scrollIntoView();", scrollable_div)
        scrollable_div.click()
        # 选择当前用户
        # self.driver.find_element(By.XPATH, listPage_auditlogSearch_input_posXpath).click()
        # self.driver.find_element(By.XPATH, listPage_auditlogSearch_input_posXpath).send_keys(user_name)
        # self.driver.find_element(By.XPATH, listPage_auditlogSearch_select_UserName_posXpath).click()

        # time.sleep(2)
        # element_user_name = self.driver.find_element(By.XPATH,f"//div[@x-placement='bottom-start']//span[text()='{user_name}']")
        # self.driver.execute_script("arguments[0].click()", element_user_name)  # 强制点击搜索出来的Name
        # 搜索
        self.driver.find_element(By.XPATH, listPage_auditlogSearch_buttonSearch_posXpath).click()
        # 搜索
        assert len(self.driver.find_elements(By.XPATH,"//div[@data-field='op_type']//span[text()='Create']")) == 1,"Create日记大于1"
        assert len(self.driver.find_elements(By.XPATH,"//div[@data-field='op_type']//span[text()='Edit']")) >= 1,"Edit日志大于1"
        assert len(self.driver.find_elements(By.XPATH,"//div[@data-field='op_type']//span[text()='Delete']")) == 1,"Delete日志大于1"
        time.sleep(1)
        operation_text_elements = self.driver.find_elements(By.XPATH,"//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='op_type']")
        if import_verify == 1:
            operation = ["Create", "Edit", "Delete", "Import", "Query Verbose"]
        else:
            operation = ["Create", "Edit", "Delete", "Query Verbose"]
        operation_text = []
        for i in range(1,len(operation_text_elements)+1):
            text = self.driver.find_element(By.XPATH,f"(//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='op_type']/span)[{i}]").text
            operation_text.append(text)
        self.check_audit_log_detail("0")
        if set(operation_text) != set(operation):
            raise Exception("存在未记录日志")

        ###校验["Export","Query List"]
        # 清除筛选框
        # search_clear_btn = self.driver.find_element(By.XPATH,listPage_auditlogSearch_input_posXpath)
        # self.driver.execute_script("arguments[0].scrollIntoView();", search_clear_btn)
        # search_clear_btn.click()
        self.driver.find_element(By.XPATH, '//span[text()="Audit Logs"]').click()
        self.driver.find_element(By.XPATH, listPage_auditlogSearch_input_posXpath).click()
        self.driver.find_element(By.XPATH, listPage_auditlogSearch_select_TargetType_posXpath).click()
        scrollable_div = self.driver.find_element(By.XPATH,f"//ul[@class='base-Popper-root MuiSelect-listbox Mui-expanded css-1wd16dk']//li[text()='{object_type}']")
        self.driver.execute_script("arguments[0].scrollIntoView();", scrollable_div)
        scrollable_div.click()
        # 选择当前用户
        # self.driver.find_element(By.XPATH, listPage_auditlogSearch_input_posXpath).click()
        # self.driver.find_element(By.XPATH, listPage_auditlogSearch_select_UserName_posXpath).click()
        # self.driver.find_element(By.XPATH, listPage_auditlogSearch_username_text_posXpath).send_keys(user_name)
        # time.sleep(2)
        # self.driver.find_element(By.XPATH, f"//div[@x-placement='bottom-start']//span[text()='{user_name}']").click()
        # 搜索
        self.driver.find_element(By.XPATH, listPage_auditlogSearch_buttonSearch_posXpath).click()

        time.sleep(7)
        operation_text_elements = self.driver.find_elements(By.XPATH,"//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='op_type']")
        other_operation_text = []
        if export_verify == 1:
            other_operation = ["Export", "Query List"]
        else:
            other_operation = ["Query List"]
        for i in range(len(operation_text_elements)):
            text = self.driver.find_element(By.XPATH,f"(//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='op_type'])[{i + 1}]").text
            other_operation_text.append(text)
        self.check_audit_log_detail("1")
        print(other_operation_text, set(other_operation_text), len(operation_text_elements))
        assert other_operation in set(other_operation_text)

    def check_audit_log_detail(self, type):
        if type == "0":  # 首次对operation = ["Create", "Edit", "Delete", "Import", "Query Verbose"]的校验
            detaile_elements = self.driver.find_elements(By.XPATH, "//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='details']")
            for i in range(1,len(detaile_elements)):
                detaile_text = self.driver.find_element(By.XPATH, f"(//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='details'])[{i + 1}]").text
                self.driver.find_element(By.XPATH, f"(//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='details'])[{i + 1}]").click()
                if detaile_text == "Compare":
                    compare_verision = self.driver.find_elements(By.XPATH, "//div[@class='overflow-hidden']//tbody//tr")
                    assert len(compare_verision) != 0, "Compare存在修改信息"
                elif detaile_text == "View":
                    assert self.driver.find_element(By.XPATH, url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath1).text != ""
                    assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_type_posXpath1).text != ""
                    assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_ip_posXpath1).text != ""
                    assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_time_posXpath1).text != ""
                    assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_user_posXpath1).text != ""
                self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
        elif type == "1":  # 对 other_operation = ["Export", "Query List"]的校验
            detaile_elements = self.driver.find_elements(By.XPATH,"//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='details']")
            detaile_index = random.randint(1, len(detaile_elements))
            self.driver.find_element(By.XPATH,f"(//div[@class='MuiDataGrid-virtualScrollerContent css-0']//div[@data-field='details'])[{detaile_index + 1}]").click()
            assert self.driver.find_element(By.XPATH,url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath1).text != ""
            assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_type_posXpath1).text != ""
            assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_ip_posXpath1).text != ""
            assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_time_posXpath1).text != ""
            assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_user_posXpath1).text != ""
        # self.driver.find_element(By.XPATH,"(//button[@id='test-compareHistorical-_system_PolicyConfigurationLog_Home_App_anonymousComponent']//span[normalize-space(text())='Compare'])[1]").click()
        # compare_verision = self.driver.find_elements(By.XPATH,"//div[@class='rm-content']//div[@class='el-table__body-wrapper is-scrolling-none']//tr[@class='el-table__row']")
        # assert len(compare_verision) != 0,"Compare存在修改信息"
        # self.driver.find_element(By.ID,"interceptionadd_allcancelobject10-_AuditLogs_system_PolicyConfigurationLog_Home_App_anonymousComponent").click()
        # self.driver.find_element(By.XPATH,"(//button[@id='test-compareHistorical-_system_PolicyConfigurationLog_Home_App_anonymousComponent']//span[normalize-space(text())='View'])[1]").click()
        # assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_id_posXpath).text != ""
        # assert self.driver.find_element(By.XPATH,url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath).text !=""
        # assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_type_posXpath).text != ""
        # assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_ip_posXpath).text != ""
        # assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_time_posXpath).text != ""
        # assert self.driver.find_element(By.XPATH,ObjectDetailPage_audit_log_compare_user_posXpath).text != ""

    def verify_import_drawer_result(self, data_file_name):
        time.sleep(10)
        """
        import 侧滑页面校验
        :param data_file_name:
        :return:
        """
        from collections import Counter
        value_pos = acc_ObjectDetailPage_importDrawer_importTipsValue_posXpath_template
        # 页面Import Tips中获取结果
        valid_num = int(self.driver.find_element(By.XPATH, ObjectDetailPage_importDrawer_importTipsValue_Valid_posXpath).text)
        self.invalid_format_num = int(self.driver.find_element(By.XPATH,ObjectDetailPage_importDrawer_importTipsValue_InvalidFormat_posXpath).text)
        duplicate_within_file_num = int(self.driver.find_element(By.XPATH, ObjectDetailPage_importDrawer_importTipsValue_Duplicates_current_file_posXpath).text)
        duplicate_within_existing_num = int(self.driver.find_element(By.XPATH, ObjectDetailPage_importDrawer_importTipsValue_Duplicates_global_objects_posXpath).text)
        total_num = int(self.driver.find_element(By.XPATH,ObjectDetailPage_importDrawer_importTipsValue_Total_posXpath).text)
        # 页面 importTable中获取结果
        failed_items_num_in_import_table = len(self.driver.find_elements(By.XPATH, ObjectDetailPage_importDrawer_importTable_Failed_items_posXpath))
        total_num_in_import_table = int(self.driver.find_element(By.XPATH,ObjectDetailPage_importDrawer_importTable_Total_posXpath).text[6:])
        # 文件中统计结果
        with open(self.my_files._obj_files_path(file_name=data_file_name), "r",
                  encoding='utf-8') as f:  # 打开文件
            lines = f.readlines()
            total_num_in_file = len(lines)  # 对应total_num
            # 统计每行出现的次数
            line_counts = Counter(lines)
            # 重复数据条数
            duplicate_num_in_file = sum(
                count - 1 for count in line_counts.values() if count > 1)  # 对应duplicate_within_file_num
        print(valid_num,total_num,duplicate_within_file_num,self.invalid_format_num,total_num_in_file,duplicate_num_in_file,self.invalid_format_num,total_num_in_import_table,failed_items_num_in_import_table)
        # 对比结果
        assert valid_num == total_num - (duplicate_within_file_num + self.invalid_format_num) == total_num_in_file - (
                duplicate_num_in_file + self.invalid_format_num) == total_num_in_import_table - failed_items_num_in_import_table

    def audit_log_check(self, type, operation):
        # 点击audit Logs
        self.driver.find_element(By.XPATH, main_button_audit_button_posXpath).click()
        if operation == 'Create':
            assert len(self.driver.find_elements(By.XPATH,"//div[@class='el-table__body-wrapper is-scrolling-none']//tbody/tr")) == 1
        elif operation == 'Edit':
            assert len(self.driver.find_elements(By.XPATH,"//div[@class='el-table__body-wrapper is-scrolling-none']//tbody/tr")) == 2
        self.driver.find_element(By.XPATH,
                                 acc_ObjectDetailPage_auditLogsDrawer_firstRowLog_checkBox_posXpath).click()  # 勾选第一行log CheckBox
        self.driver.find_element(By.XPATH,
                                 acc_ObjectDetailPage_auditLogsDrawer_compareButton_posXpath).click()  # 点击compare 按钮
        source_ip = self.loginout_parse.get("remote_url", "url").replace("http://", "").split(":")[
            0]  # 获取字符串http://192.168.39.77:4444地址中的ip
        if source_ip == 'localhost':
            source_ip = str(socket.gethostbyname(socket.gethostname()))
        assert self.driver.find_element(By.XPATH,
                                        ObjectDetailPage_audit_log_compare_version_posXpath).text != "", "断言版本不为空"
        if type == "Application Object":
            assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_id_posXpath).text == \
                   self.table_dict1["ID"]
        else:
            assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_id_posXpath).text == \
                   self.table_dict["ID"]
        # 页面获取元素文本
        operation_text = self.driver.find_element(By.XPATH,
                                                  url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath).text
        type_text = self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_type_posXpath).text
        source_ip_text = self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_ip_posXpath).text
        time_text = self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_time_posXpath).text
        user_text = self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_user_posXpath).text
        assert operation_text == operation, "校验失败!预期:{},页面实际:{}".format(operation, operation_text)
        assert type_text == type, "校验失败!预期:{},页面实际:{}".format(type, type_text)
        assert source_ip_text == source_ip, "校验失败!预期:{},页面实际:{}".format(source_ip, source_ip_text)
        assert time_text != "", "校验失败!页面实际:{}".format(time_text)
        user_name = self.loginout_parse.get("ui_account_1", "username")
        assert user_name in user_text, "校验失败!预期:{},页面实际:{}".format(user_name, user_text)
        # assert self.driver.find_element(By.XPATH,
        #                                 url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath).text == operation
        # assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_type_posXpath).text == type
        # assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_ip_posXpath).text == source_ip
        # assert self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_time_posXpath).text != ""
        # assert self.loginout_parse.get("ui_account_1", "username") in self.driver.find_element(By.XPATH,
        #                                                                                        ObjectDetailPage_audit_log_compare_user_posXpath).text
        if operation == "Edit":
            self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_cancel_posXpath).click()
            self.driver.find_element(By.XPATH, main_button_audit_button_posXpath).click()
            self.driver.find_element(By.XPATH,
                                     acc_ObjectDetailPage_auditLogsDrawer_firstRowLog_checkBox_posXpath).click()
            self.driver.find_element(By.XPATH,
                                     acc_ObjectDetailPage_auditLogsDrawer_firstRowLog_checkBox_posXpath).click()
            self.driver.find_element(By.XPATH,
                                     acc_ObjectDetailPage_auditLogsDrawer_compareButton_posXpath).click()  # 点击compare 按钮
            assert (self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_id_posXpath + "[1]").text
                    == self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_id_posXpath + "[2]").text)
            assert (self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_type_posXpath + "[1]").text
                    == self.driver.find_element(By.XPATH,
                                                ObjectDetailPage_audit_log_compare_type_posXpath + "[2]").text)
            assert (self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_ip_posXpath + "[1]").text
                    == self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_ip_posXpath + "[2]").text)
            assert (self.driver.find_element(By.XPATH, ObjectDetailPage_audit_log_compare_user_posXpath + "[1]").text
                    == self.driver.find_element(By.XPATH,
                                                ObjectDetailPage_audit_log_compare_user_posXpath + "[2]").text)
            assert self.driver.find_element(By.XPATH,
                                            url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath + "[1]").text == "Create"
            assert self.driver.find_element(By.XPATH,
                                            url_ObjectDetailPage_auditLogsDrawer_compareDrawer_operationText_posXpath + "[2]").text == "Edit"

    def verify_obj_reference_count(self, button_disabled):
        reference_count_elem_posXpath = '(//div[contains(@class,"obj-charts-btn") and text()>0])[last()]'
        count = self.driver.find_element(By.XPATH, reference_count_elem_posXpath).text
        # 点击reference count
        self.driver.find_element(By.XPATH, reference_count_elem_posXpath).click()  # 点击reference count,弹出侧滑页面
        # 校验reference count
        usage_policies_elems = self.driver.find_elements(By.XPATH,
                                                         listPage_referenceCount_drawerList_ruleOrObject_posXpaths)
        usage_count = len(usage_policies_elems)
        # print(usage_count, count)
        assert int(usage_count) == int(count), "reference count数目不匹配!!!{}--{}".format(usage_count, count)
        edit_button_pos = '//button[@id="objectEdit_slider" and @disabled="disabled"]'

        if button_disabled:  # 引用条目不可点击,Edit按钮不可点击
            # 校验权限
            is_item_disabled = self.driver.element_isExist(By.XPATH,
                                                           listPage_referenceCount_drawerList_disabledRuleOrObject_posXpaths)
            is_button_disabled = self.driver.element_isExist(By.XPATH, edit_button_pos)
            assert is_button_disabled == button_disabled == is_item_disabled, "校验失败!Edit按钮是否可点击预期为{},实际为{}".format(
                button_disabled, is_button_disabled)
        else:
            # 校验权限
            self.driver.find_element(By.XPATH,
                                     listPage_referenceCount_drawerList_ruleOrObject_posXpaths_template.format(
                                         1)).click()  # 点击第一个引用项目
            is_button_disabled = self.driver.element_isExist(By.XPATH, edit_button_pos)
            assert is_button_disabled == button_disabled, "校验失败!Edit按钮是否可点击预期为{},实际为{}".format(
                button_disabled, is_button_disabled)
            # 验证页面跳转
            self.driver.find_element(By.XPATH, '//button[@id="objectEdit_slider"]').click()  # 点击EditButton,跳转至引用对象详情页
            is_page_right = self.driver.element_isExist(By.XPATH, '//div[@class="panel-header"]')
            assert is_page_right, "校验失败!页面未成功开启!!"
    def add_sub_objects_by_search(self):
        # self.driver.implicitly_wait(5)
        while True:
            self.driver.isElementExist('//div[@class="EditDraw"]//div[@class="el-loading-mask"]')
            if not self.driver.Exist:
                break
        self.driver.find_element(By.XPATH, '//div[@data-desc="subObject"]/label').click()
        # 判断是否存在Subordinate Objects 下的"+"按钮
        if self.is_element_clickable(acc_ObjectGroupDetailPage_subObjects_addButton_normalAdd_posXpath,
                                     "XPATH"):
            print("有数据新建")
            # 点击Subordinate Objects 下的"+"按钮
            self.driver.find_element(By.XPATH,
                                     acc_ObjectGroupDetailPage_subObjects_addButton_normalAdd_posXpath).click()
        else:
            print("无数据新建")
            # 点击Subordinate Objects 下的"+"按钮
            self.driver.find_element(By.XPATH, acc_ObjectGroupDetailPage_subObjects_addButton_newAdd_posXpath).click()
        # 侧滑页面搜索并添加对应Object
        self.driver.find_element(By.XPATH, urlGroup_ObjectDetailPage_subItemSearch_posXpath).send_keys("test_ui")
        self.driver.find_element(By.XPATH, urlGroup_ObjectDetailPage_subItemSearch_posXpath).send_keys(Keys.ENTER)
        self.driver.find_element(By.XPATH, url_ObjectDetailPage_firstUrlObject).click()  # 选择第一个Object

    def global_delete_method(self, obj_type):
        # obj_and_posid = {"accounts":"Objects_account","flags":"Objects_flag"}
        if "link" in obj_type:
            return 0
        objects = {
            "accounts": "Objects_account",
            "apns": "Objects_apn",
            "app_attributes": "Application_customizedAttr",
            "app_signatures": "Application_appSignatures",
            "applications": "Application_applications",
            "applicationgroups": "Application_appGroups",
            "asns": "Objects_asn",
            "categories": "Objects_fqdn_category",
            "flags": "Objects_flag",
            "fqdns": "Objects_fqdn",
            "geolocation": "Advanced/IP_Libraries",
            "http_signatures": "Objects_http_signature",
            "intervals": "Objects_interval",
            "ip_address": "Objects_ip",
            "keywords": "Objects_keywords",
            "moible_identities": "Objects_mobile_identity",
            "ports": "Objects_port",
            "subscriber_ids": "Objects_subscriberid",
            "tunnels": "Objects_tunnel",
            "urls": "Objects_url"
        }
        # if obj_type[-1] == "s":
        #     obj_type = obj_type[0:-1]
        # Vsys切换
        # 切换UI自动化使用vsys
        self.profile_pub.change_vsys(vsys_name=self.vsys_name)
        # 页面跳转
        self.driver.find_element(By.ID, mainPage_firstLevelMenu_Objects_posId).click()
        try:
            is_leave_this_page_exist = self.driver.element_isExist(By.XPATH,
                                                                   asn_ObjectDetailPage_leaveThisPage_yesButton_posXpath)
            if is_leave_this_page_exist:
                self.driver.find_element(By.XPATH, asn_ObjectDetailPage_leaveThisPage_yesButton_posXpath).click()
        except:
            pass
        self.driver.find_element(By.ID, objects[obj_type]).click()
        # if objects[obj_type] == "Application_appGroups":
        #     self.driver.find_element(By.ID, listPage_objectSearch_Attributes_selectLabel_posId).click()  # 选中查询框
        #     self.driver.find_element(By.ID, listPage_objectSearch_app_group_select_Name_posId).click()  # 选中Name
        #     self.driver.find_element(By.XPATH, listPage_objectSearch_Attributes_input_Name_posXpath).send_keys(
        #         ""test)  # 输入Name
        #     self.driver.find_element(By.ID, mainPage_ObjectSearch_buttonSearch_posId).click()
        # elif objects[obj_type] == "Application_applications":
        #     self.driver.find_element(By.ID, listPage_objectSearch_Attributes_selectLabel_posId).click()  # 选中查询框
        #     time.sleep(1)
        #     self.driver.find_element(By.ID, application_search_by_name).click()  # 选中Name
        #     time.sleep(1)
        #     self.driver.find_element(By.XPATH, listPage_objectSearch_Attributes_input_Name_posXpath).send_keys(
        #         "test")  # 输入Name
        #     time.sleep(1)
        #     self.driver.find_element(By.ID, mainPage_ObjectSearch_buttonSearch_posId).click()
        # elif objects[obj_type] == "Application_appSignatures":
        #     self.driver.find_element(By.ID, listPage_objectSearch_Attributes_selectLabel_posId).click()  # 选中查询框
        #     self.driver.find_element(By.ID, listPage_objectSearch_signature_select_Name_posId).click()  # 选中Name
        #     self.driver.find_element(By.XPATH, listPage_objectSearch_Attributes_input_Name_posXpath).send_keys("test")
        #     self.driver.find_element(By.ID, mainPage_ObjectSearch_buttonSearch_posId).click()
        # elif objects[obj_type] == "Application_customizedAttr":
        #     self.driver.find_element(By.ID, listPage_objectSearch_Attributes_selectLabel_posId).click()  # 选中查询框
        #     self.driver.find_element(By.ID, listPage_objectSearch_Attributes_select_Name_posId).click()  # 选中Name
        #     self.driver.find_element(By.XPATH, listPage_objectSearch_Attributes_input_Name_posXpath).send_keys(
        #         "test")  # 输入Name
        #     self.driver.find_element(By.ID, mainPage_ObjectSearch_buttonSearch_posId).click()
        # else:
        #     # 简单筛选
        #     self.clear_name_by_id(listPage_auditlogSearch_input_posXpath)
        #     objects_search_input_elem = self.wait.until(
        #         EC.presence_of_element_located((By.ID, listPage_auditlogSearch_input_posXpath)))
        #     objects_search_input_elem.send_keys("test")
        #     self.wait.until(
        #         EC.presence_of_element_located(
        #             (By.XPATH, '//div[contains(@x-placement,"bottom-start")]//span[text()="Name"]'))).click()
        #     # objects_search_input_elem.send_keys(Keys.ENTER)  # 确认输入框内容
        #     self.driver.find_element(By.ID, mainPage_ObjectSearch_buttonSearch_posId).click()  # 点击搜索按钮
        # 删除数据(删除第一页所有可删除的数据,循环loop_count次)
        delable_objs_exist = self.driver.element_isExist(By.XPATH,
                                                         listPage_object_tableCheckbox_localVsysAndReferenceEqualO_objectOrGroup_posXpaths)  ## 列表页中本Vsys的Object 或Group(不包含其他Vsys)且Reference Count==0
        loop_count = 5
        while loop_count > 0 and delable_objs_exist:
            try:
                time.sleep(1)
                delable_objs = self.driver.find_elements(By.XPATH,
                                                         listPage_object_tableCheckbox_localVsysAndReferenceEqualO_objectOrGroup_posXpaths)  ## 列表页中本Vsys的Object 或Group(不包含其他Vsys)且Reference Count==0
                if len(delable_objs) == 0:
                    break
                else:
                    for i in range(len(delable_objs)):
                        try:
                            # 使用显式等待确保元素可点击
                            element = self.wait.until(EC.presence_of_element_located((By.XPATH,
                                                                                      listPage_object_tableCheckbox_localVsysAndReferenceEqualO_objectOrGroup_posXpaths_template.format(
                                                                                          i + 1))))
                            self.driver.execute_script("arguments[0].scrollIntoView();", element)
                            element.click()
                        except StaleElementReferenceException:
                            # 如果发生StaleElementReferenceException,重新获取元素并尝试点击
                            delable_objs = self.driver.find_elements(By.XPATH,
                                                                     listPage_object_tableCheckbox_localVsysAndReferenceEqualO_objectOrGroup_posXpaths)  ## 列表页中本Vsys的Object 或Group(不包含其他Vsys)且Reference Count==0
                            delable_objs[i].click()
                    self.common_delete()
            finally:
                loop_count -= 1

    def policy_create(self, object_type, rule, rule_element):
        self.driver.implicitly_wait(5)
        # try:
        #     self.driver.find_element(By.XPATH, '//span[text()="{}"]'.format(rule_element)).click()
        # except:
        if rule == "Security":
            self.driver.find_element(By.XPATH, "//span[text()='Policies']").click()
        else:
            pass
        self.driver.find_element(By.XPATH, '//span[text()="{}"]'.format(rule_element)).click()
        self.driver.find_element(By.XPATH, listpage_create_button_posXpath).click()
        self.driver.find_element(By.XPATH, ObjectDetailPage_input_Name_posXpath).send_keys("test_policy")
        self.get_policy_conditions(object_type)
        if rule == "Statistics":
            self.driver.find_element(By.XPATH,statistics_policy_template_add_button_posXpath).click()
            time.sleep(2)
            self.driver.find_element(By.XPATH,statistics_policy_template_first_template_posXpath).click()
            self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
            # self.driver.execute_script("arguments[0].click()", first_statistics_template)
            # self.driver.find_element(By.XPATH,"//div[@class='FlagList list-box']//span[normalize-space(text())='Close']").click()
        elif rule == "DoS Protection":
            self.driver.find_element(By.XPATH, '//div[@class="dos-protection-policy-group_by"]//button').click()
            self.driver.find_element(By.XPATH, '//div[@class="dos-protection-policy-group_by"]//ul[@role="listbox"]/li[1]').click()
            self.driver.find_element(By.XPATH, '//div[@class="dos-protection-policy-concurrent_sessions"]//input').send_keys("1")
            self.driver.find_element(By.XPATH, '//button[text()="None"]').click()
        elif rule == "Intercept":
            time.sleep(1)
            self.driver.find_element(By.XPATH,'//label[normalize-space(text())="Application"]/ancestor::div[@class="intercept-policy-application"]//button/i').click()
            self.driver.find_element(By.XPATH, "//span[normalize-space(text())='http']").click()
            self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
            # self.driver.find_element(By.XPATH,"//div[@class='AppList list-box']//span[normalize-space(text())='Close']").click()
            self.driver.find_element(By.XPATH, '//label[normalize-space(text())="TCP Proxy Profile"]/following-sibling::div//button/i').click()
            self.driver.find_element(By.XPATH, statistics_policy_template_first_template_posXpath).click()
            self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
        elif rule == "Shaping":
            self.driver.find_element(By.XPATH,shaping_policy_profile_add_button_posXpath).click()
            self.driver.find_element(By.XPATH,statistics_policy_template_first_template_posXpath).click()
            self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
            # self.driver.find_element(By.XPATH,"//div[@class='SFFList list-box']//span[normalize-space(text())='Close']").click()
        elif rule == "Service Chaining":
            self.driver.find_element(By.XPATH,service_chaining_policy_ssf_add_button_posID).click()
            self.driver.find_element(By.XPATH,statistics_policy_template_first_template_posXpath).click()
            self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
            # self.driver.find_element(By.XPATH,"//div[@class='SFFList list-box']//span[normalize-space(text())='Close']").click()
        scrollable_div = self.driver.find_element(By.XPATH, '//label[normalize-space(text())="Enabled"]/following-sibling::div/span')
        self.driver.execute_script("arguments[0].scrollIntoView();", scrollable_div)
        self.driver.find_element(By.XPATH, '//label[normalize-space(text())="Enabled"]/following-sibling::div/span').click()
        self.driver.find_element(By.XPATH, '//button[text()="OK"]').click()


    def get_policy_conditions(self, object_type):
        if object_type == "ip_address":
            self.driver.find_element(By.XPATH, "(//div[@class='MultipleSelect SourceSelect'])[1]").click()
        elif object_type == "fqdns":
            self.driver.find_element(By.XPATH, policy_button_add_contions_posXpath).click()
            self.driver.find_element(By.XPATH,policy_list_add_contions_posXpath.format(replaceValue='Server FQDN')).click()
            self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
            self.driver.find_element(By.XPATH, policy_button_type_add_contions_posXpath.format(replaceValue="Server FQDN")).click()
        elif object_type == "subscriber_ids":
            self.driver.find_element(By.XPATH, policy_button_add_contions_posXpath).click()
            self.driver.find_element(By.XPATH, policy_list_add_contions_posXpath.format(replaceValue='User')).click()
            self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
            self.driver.find_element(By.XPATH,policy_button_type_add_contions_posXpath.format(replaceValue="User")).click()
        elif object_type == "imsi" or object_type == "phone_number" or object_type == "imei" or object_type == "apn":
            self.driver.find_element(By.XPATH, policy_button_add_contions_posXpath).click()
            self.driver.find_element(By.XPATH, policy_list_add_contions_posXpath.format(replaceValue='Device')).click()
            self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
            self.driver.find_element(By.XPATH,policy_button_type_add_contions_posXpath.format(replaceValue="Device")).click()
            if object_type == "phone_number":
                self.driver.find_element(By.XPATH,"//div[@class='el-tabs__header is-top']//div[text()='Phone Number']").click()
            else:
                self.driver.find_element(By.XPATH,f"//button[text()='{object_type.upper()}']").click()
        elif object_type == "keywords":
            self.driver.find_element(By.XPATH, policy_button_add_application_posXpath).click()
            self.driver.find_element(By.XPATH,"//ul[@class='row-container tableList apptableList']//span[text()='http']").click()
            self.driver.find_element(By.XPATH, policy_button_add_contions_posXpath).click()
            self.driver.find_element(By.XPATH,policy_list_add_contions_posXpath.format(replaceValue='Request Body')).click()
            self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
            self.driver.find_element(By.XPATH,policy_button_add_filter_psXpath.format(replaceValue='Request Body')).click()
        elif object_type == "http_signatures":
            self.driver.find_element(By.XPATH, policy_button_add_application_posXpath).click()
            self.driver.find_element(By.XPATH,"//ul[@class='row-container tableList apptableList']//span[text()='http']").click()
            self.driver.find_element(By.XPATH, policy_button_add_contions_posXpath).click()
            self.driver.find_element(By.XPATH,policy_list_add_contions_posXpath.format(replaceValue='Request Header')).click()
            self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
            self.driver.find_element(By.XPATH,policy_button_add_filter_psXpath.format(replaceValue='Request Header')).click()
        elif object_type == "ports":
            self.driver.find_element(By.XPATH, policy_button_add_contions_posXpath).click()
            self.driver.find_element(By.XPATH, policy_list_add_contions_posXpath.format(replaceValue='Port')).click()
            self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
            self.driver.find_element(By.XPATH, policy_button_add_filter_psXpath.format(replaceValue='Port')).click()
        self.driver.find_element(By.XPATH,'//input[@class="MuiInput-input css-za5rna"]').send_keys(self.table_dict["Name"] + Keys.ENTER)
        self.driver.find_element(By.XPATH, '//ul[@class="MuiList-root MuiList-vertical MuiList-variantPlain MuiList-colorNeutral MuiList-sizeMd css-1cklc3"]/li[1]').click()
        self.driver.find_element(By.XPATH, '//i[@class="iconfont icon-Clear_aNormal close-icon"]').click()
        # self.driver.find_element(By.XPATH,"//div[@class='SourceList list-box']//span[normalize-space(text())='Close']").click()

    def policy_delete(self,rule_element):
        self.driver.implicitly_wait(5)
        self.driver.find_element(By.XPATH, "//span[text()='Policies']").click()
        self.driver.find_element(By.XPATH, '//span[text()="{}"]'.format(rule_element)).click()
        time.sleep(3)
        self.driver.find_element(By.XPATH, listpage_search_input_posXpath).click()
        self.driver.find_element(By.XPATH,listpage_search_input_posXpath).send_keys("test_policy")
        self.driver.find_element(By.XPATH, listPage_objectSearch_select_Name_posXpath).click()
        self.driver.find_element(By.XPATH, listpage_search_button_posXpath).click()
        time.sleep(2)
        self.driver.find_element(By.XPATH,listPage_select_first_object_posXpath).click()
        self.driver.find_element(By.XPATH,listpage_delete_button_posXpath).click()
        self.driver.find_element(By.XPATH,listpage_delete_yes_button_posXpath).click()


# path = my_files._obj_files_dowload_path()  # 替换为你的路径
# txt_filenames = get_txt_filenames(path)
# print(txt_filenames)