Skip to content
Snippets Groups Projects
Commit 43b9cd4c authored by Marco Malavolti's avatar Marco Malavolti
Browse files

Fixes

parent 1ab20a61
No related branches found
No related tags found
No related merge requests found
...@@ -9,11 +9,13 @@ import re ...@@ -9,11 +9,13 @@ import re
import requests import requests
from datetime import date from datetime import date
from eccs2properties import ECCS2LOGSDIR, ECCS2RESULTSLOG, ECCS2CHECKSLOG, ECCS2SELENIUMLOG, ECCS2SELENIUMLOGLEVEL, FEDS_BLACKLIST, IDPS_BLACKLIST, ECCS2SELENIUMPAGELOADTIMEOUT, ECCS2SELENIUMSCRIPTTIMEOUT from eccs2properties import ECCS2LOGSDIR, ECCS2RESULTSLOG, ECCS2CHECKSLOG, ECCS2SELENIUMLOGDIR, ECCS2SELENIUMLOGLEVEL, FEDS_BLACKLIST, IDPS_BLACKLIST, ECCS2SELENIUMPAGELOADTIMEOUT, ECCS2SELENIUMSCRIPTTIMEOUT
from selenium import webdriver from selenium import webdriver
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.remote.remote_connection import LOGGER from selenium.webdriver.remote.remote_connection import LOGGER
from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import TimeoutException from selenium.common.exceptions import TimeoutException
...@@ -46,7 +48,8 @@ def checkIdP(sp,idp,logger,driver): ...@@ -46,7 +48,8 @@ def checkIdP(sp,idp,logger,driver):
# Open SP, select the IDP from the EDS and press 'Enter' to reach the IdP login page to check # Open SP, select the IDP from the EDS and press 'Enter' to reach the IdP login page to check
try: try:
driver.get(sp) driver.get(sp)
driver.find_element_by_id("idpSelectInput").send_keys(idp['entityID'] + Keys.ENTER) element = WebDriverWait(driver, 50).until(EC.presence_of_element_located((By.ID,"idpSelectInput")))
element.send_keys(idp['entityID'] + Keys.ENTER)
page_source = driver.page_source page_source = driver.page_source
status_code = requests.get(driver.current_url, verify=False).status_code status_code = requests.get(driver.current_url, verify=False).status_code
...@@ -59,13 +62,8 @@ def checkIdP(sp,idp,logger,driver): ...@@ -59,13 +62,8 @@ def checkIdP(sp,idp,logger,driver):
# If I don't return anything and I don't put anything in the logger # If I don't return anything and I don't put anything in the logger
# I'll not write on the input files for the table # I'll not write on the input files for the table
# and I can re-run the command that caused the exception from the "stdout.log" file. # and I can re-run the command that caused the exception from the "stdout.log" file.
print("!!! NO SUCH ELEMENT EXCEPTION !!!") print("!!! NO SUCH ELEMENT EXCEPTION - RUN AGAIN THE COMMAND !!!")
import selenium.webdriver.support.ui as ui return None
wait = ui.WebDriverWait(driver,10)
wait.until(lambda driver: driver.find_element_by_id("idpSelectInput"))
driver.find_element_by_id("idpSelectInput").send_keys(idp['entityID'] + Keys.ENTER)
page_source = driver.page_source
status_code = requests.get(driver.current_url, verify=False).status_code
except UnexpectedAlertPresentException as e: except UnexpectedAlertPresentException as e:
logger.info("%s;%s;888;UnexpectedAlertPresent" % (idp['entityID'],sp)) logger.info("%s;%s;888;UnexpectedAlertPresent" % (idp['entityID'],sp))
...@@ -256,7 +254,7 @@ if __name__=="__main__": ...@@ -256,7 +254,7 @@ if __name__=="__main__":
checkIdp(idp,sps,eccs2log,eccs2checksLog,driver) checkIdp(idp,sps,eccs2log,eccs2checksLog,driver)
#driver.delete_all_cookies() #driver.delete_all_cookies()
#driver.close() driver.close()
driver.quit() driver.quit()
# Kill process to release resources and to avoid zombies - this reaise an issue # Kill process to release resources and to avoid zombies - this reaise an issue
......
...@@ -34,7 +34,7 @@ ECCS2SELENIUMPAGELOADTIMEOUT = 30 ...@@ -34,7 +34,7 @@ ECCS2SELENIUMPAGELOADTIMEOUT = 30
ECCS2SELENIUMSCRIPTTIMEOUT = 30 ECCS2SELENIUMSCRIPTTIMEOUT = 30
# Number of processes to run in parallel # Number of processes to run in parallel
ECCS2NUMPROCESSES = 15 ECCS2NUMPROCESSES = 30
# Registration Authority of Federations to exclude from the check # Registration Authority of Federations to exclude from the check
FEDS_BLACKLIST = [ FEDS_BLACKLIST = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment