I am new to python, but need to modify code created by someone else. I am not able to post the full code, but I posted most of it below:
from bs4 import Beau
A couple of points here :
switch_to_alert had been deprecated so we have to mandatory use switch_to().alert()Seems to me a purely timing issue. Hence we need to induce ExplicitWait i.e. WebDriverWait with expected_conditions clause set to alert_is_present as follows :
from selenium.webdriver.support import expected_conditions as EC
#code block
self.chrome_session.find_element_by_xpath("//input[@value='Accept']").click()
WebDriverWait(self.chrome_session, 10).until(EC.alert_is_present)
self.chrome_session.switch_to().alert().accept()
print("Accepted work order {0} at {1}.".format(link_text, datetime.datetime.now()))