from seleniumwire import webdriver
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
import time
url = 'https://sahkovertailu.fi/'
options = {
'suppress_connection_errors': False,
'connection_timeout': None# Show full tracebacks for any connection errors
}
chrome_options = Options()
chrome_options.add_argument("--start-maximized")
chrome_options.add_argument('--auto-open-devtools-for-tabs')
chrome_options.add_argument('--log-level=2')
driver = webdriver.Chrome(ChromeDriverManager().install(), seleniumwire_options=options, chrome_options=chrome_options)
if driver.requests is not None:
del driver.requests
driver.get(url)
iframe = driver.find_element_by_xpath("//iframe[contains(@src, 'privacy')]")
driver.switch_to.frame(iframe)
button = driver.find_element_by_xpath("//button[contains(., 'OK')]")
button.click()
Above code showcases the issue - it should close the cookie consent modal by clicking OK, however this does not work. Using firefox with from webdriver_manager.firefox import GeckoDriverManager however works.
Above code showcases the issue - it should close the cookie consent modal by clicking OK, however this does not work. Using firefox with
from webdriver_manager.firefox import GeckoDriverManager
however works.