Just calling the closeModal function below, when I find a modal on the page. As I can
t continue.... Once its called it seems to cause issue with finding elements. Any idea what I
have to do...
def countModals(driver):
js1 = "document.count=0;"
js1 = js1 + "document.querySelectorAll('.modal').forEach(p => {if ($(p).hasClass('show')) {document.count=document.count+1;}} );"
driver.execute_script(js1)
r = driver.execute_script("return document.count;")
driver.execute_script("delete document.count;")
return r
def closeModals(driver):
before=countModals(driver)
driver.execute_script("document.res=$('.modal').modal('hide');")
after=countModals(driver)
return (before,after)
Thanks
E