Hello there
I want to get the timing of multiple element like below
self.tapped_button_name = self.tap_next_button()
self.window_call = time.time()
self.formatted_window_call = datetime.datetime.fromtimestamp(self.window_call).strftime("%Y-%m-%d %H:%M:%S:%f")[:-3]
WebDriverWait(self.driver1, 20).until(EC.visibility_of_element_located((By.ID, 'com.ktcs.whowho:id/view_main')))
self.view_main_time = time.time() # Time when 'view_main' becomes visible
element_visibility_times = {}
for element_id, header in self.element_ids_to_headers.items():
try:
WebDriverWait(self.driver1, 20).until(EC.presence_of_element_located((By.ID, element_id)))
element_visibility_times[element_id] = time.time()
except TimeoutException:
element_visibility_times[element_id] = None
# Calculate time differences or mark as "N/A"
time_differences = {
header: round(element_visibility_times[eid] - self.view_main_time, 3)
if element_visibility_times[eid] is not None else "N/A"
for eid, header in self.element_ids_to_headers.items()
}
and here is the record for several sessions
2024-01-12 16:02:19:199,수신,2024-01-12 16:02:27:328,1.173,1.67,1.847,N/A,22.475
2024-01-12 16:04:53:480,부재,2024-01-12 16:05:02:114,1.755,1.216,1.714,N/A,23.629
2024-01-12 16:06:05:702,문자,2024-01-12 16:06:13:819,1.906,1.296,1.868,N/A,22.916
2024-01-12 16:07:59:569,수신,2024-01-12 16:08:08:157,2.277,1.19,1.616,N/A,23.113
2024-01-12 16:27:00:307,수신,2024-01-12 16:27:08:577,2.796,0.118,0.461,N/A,21.933
according to the record, only element D repeatedly time outs(it is set as 20s), but it works fine in real.
It is very strange since if element D really does not exist the result should be recoreded as N/A not the time difference, but it record the time right after timeout even when element D is already there.
any advice please?
Thank you in advance