I've written a script that successfully makes the login on Instagram. When I should go on my account, at home, the website displays a popup that asks you if you want notifications. At this point, I tried a lot of solutions, but I got nothing. I just want that, when the pop-up is displayed, the script should click on "Not now".
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
ids = []
driver = webdriver.Chrome(executable_path = '/usr/local/bin/chromedriver')
driver.get("https://www.instagram.com/accounts/login/?source=auth_switcher")
usm = driver.find_element_by_name('username').send_keys("**")
pwd = driver.find_element_by_name('password').send_keys("**")
btnLog = driver.find_element_by_tag_name('form').submit()
acpt = driver.find_element_by_xpath("//*[contains(@class, 'aOOlW HoLwm ')]")
In the image, there's the line of the button highlighted that I want to click:
To
click()
on the element with text as Not now on Instagram popup notification you can use the following solution:Try the following code for this:
PS: I have used 10-second wait for the element to be clickable before click on it.
Hope it helps you!