@@ -62,7 +62,8 @@ def report(user_index, try_times):
62
62
print ('[Error] Login failed' )
63
63
if config .users [user_index ]['use_wechat' ]:
64
64
if try_times == config .retry_times :
65
- send_wechat (user_index , strings .get_msg_failed (user_index , try_times ))
65
+ send_wechat (user_index , strings .get_msg_failed (
66
+ user_index , try_times ))
66
67
browser .quit ()
67
68
return 1
68
69
@@ -102,22 +103,10 @@ def report(user_index, try_times):
102
103
103
104
# Health Condition
104
105
condition_good = browser .find_element_by_id ('p1_DangQSTZK' ) \
105
- .find_element_by_id ( 'fineui_2-inputEl-icon' )
106
+ .find_element_by_xpath ( "//*[contains(text(), 'Good')]" )
106
107
condition_good .click ()
107
108
time .sleep (0.5 )
108
109
109
- # Dangerous Area
110
- dangerous_area = browser .find_element_by_id ('p1_CengFWH' ) \
111
- .find_element_by_id ('fineui_13-inputEl-icon' )
112
- dangerous_area .click ()
113
- time .sleep (0.5 )
114
-
115
- # Dangerous People
116
- dangerous_people = browser .find_element_by_id ('p1_JieChu' ) \
117
- .find_element_by_id ('fineui_15-inputEl-icon' )
118
- dangerous_people .click ()
119
- time .sleep (0.5 )
120
-
121
110
# In Shanghai
122
111
if config .users [user_index ]['in_shanghai' ]:
123
112
in_shanghai = browser .find_element_by_id ('p1_Shanghai' ) \
@@ -126,64 +115,44 @@ def report(user_index, try_times):
126
115
in_shanghai .click ()
127
116
time .sleep (0.5 )
128
117
129
- # Check Address
130
- check_address = browser .find_element_by_id ('p1_CheckAddress' ) \
131
- .find_element_by_id ('p1_CheckAddress-inputEl-icon' )
132
- check_address .click ()
133
- time .sleep (0.5 )
134
-
135
118
# Submit
136
119
submit_button = browser .find_element_by_id ('p1_ctl00' ) \
137
120
.find_element_by_id ('p1_ctl00_btnSubmit' )
138
121
submit_button .click ()
139
122
time .sleep (1 )
140
123
141
- # Detect submit status
142
- try :
143
- browser .find_element_by_id ('fineui_36' )
144
- except IndexError :
145
- print ('[Error] Submit failed' )
146
- if config .users [user_index ]['use_wechat' ]:
147
- if try_times == config .retry_times :
148
- send_wechat (user_index , strings .get_msg_failed (user_index , try_times ))
149
- browser .quit ()
150
- return 1
151
-
152
- # Confirm submit
153
- yes_button_1 = browser .find_element_by_id ('fineui_36' ) \
154
- .find_element_by_id ('fineui_38' ) \
155
- .find_element_by_id ('fineui_39' )
156
- yes_button_1 .click ()
157
- time .sleep (1 )
158
-
159
124
# Waiting for submit result
160
125
for i in range (int (config .timeout / 3 )):
161
- time .sleep (3 )
162
126
try :
163
- browser .find_element_by_id ('fineui_41' )
127
+ browser .find_element_by_class_name ('f-window' ) \
128
+ .find_elements_by_xpath (
129
+ "//*[contains(text(), 'Submit successfully')]" )
164
130
except exceptions .NoSuchElementException :
165
- print ('[Info] Waiting: ' + str (i * 3 ) +
131
+ time .sleep (3 )
132
+ print ('[Info] Waiting: ' + str ((i + 1 ) * 3 ) +
166
133
' / ' + str (config .timeout ) + ' seconds' )
167
134
continue
168
135
break
169
136
170
137
try :
171
- browser .find_element_by_id ('fineui_41' )
138
+ browser .find_element_by_class_name ('f-window' ) \
139
+ .find_elements_by_xpath (
140
+ "//*[contains(text(), 'Submit successfully')]" )
172
141
except exceptions .NoSuchElementException :
173
142
print ('[Error] Submit timeout' )
174
143
if config .users [user_index ]['use_wechat' ]:
175
144
if try_times == config .retry_times :
176
- send_wechat (user_index , strings .get_msg_failed (user_index , try_times ))
145
+ send_wechat (user_index , strings .get_msg_failed (
146
+ user_index , try_times ))
177
147
browser .quit ()
178
148
return 1
179
149
180
150
print ('[Info] Reported successfully' )
181
151
182
- # Confirm the success message
183
- yes_button_2 = browser .find_element_by_id ('fineui_41' ) \
184
- .find_element_by_id ('fineui_43' ) \
185
- .find_element_by_id ('fineui_44' )
186
- yes_button_2 .click ()
152
+ # Click done
153
+ done_button = browser .find_element_by_class_name ('f-window' ) \
154
+ .find_element_by_class_name ('f-btn' )
155
+ done_button .click ()
187
156
time .sleep (1 )
188
157
189
158
# Check rank
@@ -200,7 +169,8 @@ def report(user_index, try_times):
200
169
print ('[Error] Check failed' )
201
170
if config .users [user_index ]['use_wechat' ]:
202
171
if try_times == config .retry_times :
203
- send_wechat (user_index , strings .get_msg_failed (user_index , try_times ))
172
+ send_wechat (user_index , strings .get_msg_failed (
173
+ user_index , try_times ))
204
174
browser .quit ()
205
175
return 1
206
176
0 commit comments