I want to hide this message in selenium python
it appears when i click on continue to discord
after doing :
driver.find_elements(By.XPATH,'//div[@id="app-mount"]/div[2]/div/div[1]/div/div/section/div/button').click()
CodePudding user response:
looks like it is alert.
to accept it in java
driver.switchTo().alert().accept();
to cancel it
driver.switchTo().alert().dismiss();
refer : https://www.selenium.dev/documentation/webdriver/browser/alerts/
CodePudding user response:
In Python you can try to dismiss the alert.
driver.switch_to.alert.dismiss()
Or else you can use a keystroke using pynput module. You need to install the pynput module first. Then,
from pynput.keyboard import Key, Controller
keyboard = Controller()
keyboard.press(Key.enter)
keyboard.release(Key.enter)