def something:
driver = webdriver.Chrome()
driver.get('https://toster.ru/')
driver.execute_script(
"var context = document.getElementsByTagName('h1')[0];"
"var btn = document.createElement('BUTTON');"
"btn.id = 'randomID';"
"btn.value = 'wait';"
"btn.innerHTML = 'CLICK ME';"
"btn.onclick = function(){this.value = 'OK';return false;};"
"context.appendChild(btn);")
element = driver.find_element_by_id("randomID")
while element.get_attribute("value") == "wait":
time.sleep(2)