-
Notifications
You must be signed in to change notification settings - Fork 4
/
loc.py
109 lines (92 loc) · 5.66 KB
/
loc.py
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
import random
from selenium.webdriver.common.by import By
class Locators:
# +menu
add_menu_loc = (By.XPATH, '//*[@id="root"]/div/div/div/div/div[1]/div/img')
# Menu drop-down box to add friends
add_friend_loc = (By.XPATH, '/html/body/div[2]/div/div/div/div/div/div[1]/div')
# Enter friend account box
add_input_account_loc = (By.CSS_SELECTOR, 'input.ant-input.ant-input-outlined')
# confirm
add_input_confirm_loc = (By.CSS_SELECTOR, 'button.ant-btn.ant-btn-primary.px-6')
# mx-2.flex.cursor-pointer.items-center.rounded-md.p-3:nth-of-type(1)
# Profile”add friend“
add_friend_info_loc = (By.CSS_SELECTOR, 'button.ant-btn.ant-btn-primary.flex-1:nth-of-type(1)')
# Profile "Send Message"
send_strange_info_loc = (By.CSS_SELECTOR, 'button.ant-btn.ant-btn-primary.flex-1:nth-of-type(2)')
# Send verification content to friend
send_info_loc = (
By.CSS_SELECTOR, 'textarea.ant-input.css-1f72xif')
# Confirm sending
end_confirm_loc = (By.CSS_SELECTOR, 'button.ant-btn.ant-btn-primary.flex-1')
tip_msg_loc = (By.XPATH, '/html/body/div[4]/div/div/div/div')
# input box for sending messages
msg_input_loc = (By.CSS_SELECTOR, 'div.ck-content.ck-editor__editable p')
# message button
send_msg_btn_loc = (By.CSS_SELECTOR, 'button.ant-btn.ant-btn-primary.ant-btn-compact-item'
'.ant-btn-compact-first-item')
# Message box after sending message
msg_panel_loc = (By.CSS_SELECTOR, 'div._bubble_1t138_10')
# Message box to receive messages
received_panel_loc = (By.CSS_SELECTOR, '._message-container_1t138_1:not(._message-container-sender_1t138_21)'
' ._bubble_1t138_10')
# used for send pictures and video files ,this input
# 用于选择文件的input元素定位器模板
# file_input_locator = (By.CSS_SELECTOR, 'input[type="file"]')
# image_upload_input_loc = (By.CSS_SELECTOR,'input[type="file"]')
file_type_to_loc = {
'image': (By.CSS_SELECTOR, 'input[type="file"][accept="image/*"]'),
'video': (By.CSS_SELECTOR, 'input[type="file"][accept=".mp4"]'),
'file': (By.CSS_SELECTOR, 'input[type="file"][accept="*"]')
}
file_sent_success_loc = {
'image': (By.CSS_SELECTOR, 'img[src*="msg_picture"]'),
'video': (By.CSS_SELECTOR, 'img[src*="msg_videoSnapshot"]'),
'file': (By.XPATH, '//div[@class="ant-spin-container"]/div/div/div[contains(text(),"OpenIM.pdf")]')
}
video_svg = (By.CSS_SELECTOR, 'path._triangle_iu6ca_19')
file_vir_success_loc = {
'image': (By.XPATH, '// *[ @ id = "chat_b37eb95cdee1324548c48a9f99143688"] / '
'div / div / span / div[1] / div / div / div'),
'video': (By.XPATH, '// *[ @ id = "chat_0b2e2511e2ec2f5dd31e36d727ab9c3b"] / '
'div / div / span / div[1] / div / div / div[1] / img'),
# 'file': (By.XPATH, '//div[@class="ant-spin-container"]/div/div/div[contains(text(),"OpenIM.pdf")]'),
# 'file': (By.CSS_SELECTOR, 'img[src*="http://192.168.2.20:10002/object/8745629711/'
# 'msg_videoSnapshot_2c4a488a52392039d47696c6d3853e8d.png"]')
}
# Specify picture
# img1 = (By.CSS_SELECTOR, 'img[src*="http://192.168.2.20:10002/'
# 'object/8745629711/msg_picture_55bdf4cb39e3c472bb1be6c56581f237.png"]')
# img1 = (By.XPATH, ' // *[ @ id = "chat_b37eb95cdee1324548c48a9f99143688"] / '
# 'div / div / span / div[1] / div / div / div')
#
# # Specify video
# # video1 = (By.CSS_SELECTOR, 'img[src*="http://192.168.2.20:10002/object/8745629711/'
# # 'msg_videoSnapshot_2c4a488a52392039d47696c6d3853e8d.png"]')
# video1 = (By.XPATH, '// *[ @ id = "chat_0b2e2511e2ec2f5dd31e36d727ab9c3b"] / '
# 'div / div / span / div[1] / div / div / div[1] / img')
#
# # Specify file
# # '#chat_cee4930d6393aa93019c08971044355f > div > div > span > div.ant-spin-nested-loading.css-1eammq7 > div > div')
# # //div[@class="ant-spin-container"]/div/div/div[contains(text(),"OpenIM.pdf")]
# file1 = (By.XPATH, '//div[@class="ant-spin-container"]/div/div/div[contains(text(),"OpenIM.pdf")]')
# Agree with friends
contacts = (By.CSS_SELECTOR, '#root > div > div > div > div > div.ant-layout.ant-layout-has-sider'
'.css-1f72xif > aside > div > div > span:nth-child(3) > div > div')
# New friend request
newFriend_list = (By.CSS_SELECTOR, 'li.mx-2.flex.cursor-pointer.items-center.rounded-md.p-3:nth-of-type(1)')
# agree
agree = (By.CSS_SELECTOR, 'button.ant-btn.css-1f72xif.ant-btn-primary.ant-btn-sm')
# reject
reject = (By.CSS_SELECTOR, 'button.ant-btn.css-1f72xif.ant-btn-default')
# nickname
friend_name = (By.CSS_SELECTOR, 'p.text-sm')
session_friendList_loc = (By.CSS_SELECTOR, "div[data-test-id='virtuoso-scroller'] "
".ant-avatar-square:not(.ant-avatar-image) > span.ant-avatar-string")
Specify_friend_loc = (By.CSS_SELECTOR, " div[data-test-id='virtuoso-scroller'] .div.flex-1.truncate.font-medium")
# del_vator_loc=(By.CSS_SELECTOR,'div.flex.h-full.items-center.leading-none span.ant-avatar.ant-avatar-square')
setting_loc = (By.CSS_SELECTOR, 'img.ml-5.cursor-pointer:nth-of-type(3)')
del_loc = (By.CSS_SELECTOR,'button.ant-btn.ant-btn-primary.ant-btn-dangerous')
del_confirm_loc = (By.XPATH,"//button[contains(., '确定')]")
# del_not_loc = (By.XPATH,"//button[contains(., '取消')]")
two_avtor_loc = (By.XPATH,'//*[@id="chat-container"]/div[2]/div[3]/div/div[2]/div[1]')