mirror of https://github.com/OpenVidu/openvidu.git
deployment: openvidu_health_check - fix error when 'about:webrtc' page refresh its data
parent
6c122cd645
commit
ddaf34a475
|
@ -21,7 +21,7 @@ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key
|
||||||
google-chrome-stable firefox \
|
google-chrome-stable firefox \
|
||||||
&& rm /etc/apt/sources.list.d/google-chrome.list
|
&& rm /etc/apt/sources.list.d/google-chrome.list
|
||||||
|
|
||||||
RUN pip3 install selenium webdriver_manager prettytable
|
RUN pip3 install selenium webdriver_manager prettytable beautifulsoup4
|
||||||
|
|
||||||
WORKDIR /workdir
|
WORKDIR /workdir
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ from selenium.webdriver.chrome.service import Service as ChromeService
|
||||||
from selenium.webdriver.firefox.service import Service as FirefoxService
|
from selenium.webdriver.firefox.service import Service as FirefoxService
|
||||||
from selenium.webdriver.common.keys import Keys
|
from selenium.webdriver.common.keys import Keys
|
||||||
from selenium.webdriver.common.by import By
|
from selenium.webdriver.common.by import By
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
from prettytable import from_html_one
|
from prettytable import from_html_one
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
|
@ -94,9 +95,7 @@ class InfraSmokeTests(unittest.TestCase):
|
||||||
if video_error == True:
|
if video_error == True:
|
||||||
raise Exception('Error. No video detected')
|
raise Exception('Error. No video detected')
|
||||||
|
|
||||||
time.sleep(3)
|
|
||||||
self.driver.switch_to.window(self.driver.window_handles[0])
|
self.driver.switch_to.window(self.driver.window_handles[0])
|
||||||
time.sleep(3)
|
|
||||||
elem = self.driver.find_element(By.ID,'test-btn')
|
elem = self.driver.find_element(By.ID,'test-btn')
|
||||||
elem.send_keys(Keys.RETURN)
|
elem.send_keys(Keys.RETURN)
|
||||||
|
|
||||||
|
@ -169,16 +168,17 @@ class InfraSmokeTests(unittest.TestCase):
|
||||||
print("Waiting for candidates to be checked...")
|
print("Waiting for candidates to be checked...")
|
||||||
# Get ice stats
|
# Get ice stats
|
||||||
time.sleep(15)
|
time.sleep(15)
|
||||||
ice_stats_div_elems = self.driver.find_elements(By.XPATH, "//div[contains(@id, 'ice-stats')]")
|
# about:webrtc page refreshes each second, so we need to
|
||||||
for ice_stats_div in ice_stats_div_elems:
|
# safe the entire HTML in a variable to have a Snapshot of the situation
|
||||||
table_elems = ice_stats_div.find_elements(By.TAG_NAME, 'table')
|
about_webrtc_html = '<html>' + self.driver.find_element(By.TAG_NAME, 'html').get_attribute('innerHTML') + '</html>'
|
||||||
ice_candidates_table = table_elems[0]
|
# Search the tables using a parser and print all candidates
|
||||||
html_ice_table = '<table>' + ice_candidates_table.get_attribute('innerHTML') + '</table>'
|
soup = BeautifulSoup(about_webrtc_html, 'html.parser')
|
||||||
print(from_html_one(html_ice_table))
|
for caption in soup.findAll('caption', {'data-l10n-id' : 'about-webrtc-trickle-caption-msg'}):
|
||||||
# Go to main window
|
print(from_html_one(str(caption.parent)))
|
||||||
|
# Close about:webrtc
|
||||||
self.driver.close()
|
self.driver.close()
|
||||||
except:
|
except:
|
||||||
pass
|
print('[Warn] Some candidates may not appear in test result')
|
||||||
|
|
||||||
def closeBrowser(self):
|
def closeBrowser(self):
|
||||||
# close the browser window
|
# close the browser window
|
||||||
|
|
Loading…
Reference in New Issue