0

When I open the page a window alert occurs and I want to dismiss it but I tried every suggested solution and nothing has worked. I tried the following commands right after self.get(url)

driver.execute_script("window.alert = function() { return true; }")
driver.switch_to.alert().dismiss()
            try:
                WebDriverWait(driver, 10).until(EC.alert_is_present(),
                                                 'Timed out')

                alert = driver.switch_to.alert
                alert.dismiss()
            except TimeoutException:
                print("There is no alert window.")

I'm using the chrome driver. My chrome is up to date and the I have the latest version of selenium

enter image description here

Griden
  • 23
  • 1
  • 6

1 Answers1

1

It seems that you are trying to close this alert in zoom's website. I found out that this specific kind of alert is managed by the OS (Selenium C# How to handle Alert "Open Pick an app"?).

Fortunately, there is a workaround. You can simply simulate a ENTER with another lib. i tried that here and it worked.

from pynput.keyboard import Key, Controller

try:
    driver.get("https://zoom.us/j/7927928053?_x_zm_rtaid=dn4yDpeITbyXA8CmfOtPbA.1585865584355.d6bc70631d24610d94512df4caf63e47&_x_zm_rhtaid=65")
    try:
        sleep(4)
        keyboard.press(Key.enter)
        keyboard.release(Key.enter)
        sleep(4)
    except Exception:
        traceback.print_exc()
        print("There is no alert window.")
except Exception:
    pass

I Had to remove your waits, sorry about that :)

Hope it helps!