I’ve been trying to write a code that would download a csv file from my camera web service (available only on IE). Unfortunately as soon as it gets to confirm_button.click()
the download dialog pops up and python hangs until I manually close the dialog. That way it executes the pyautogui part after it’s no longer useful.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
import os
from datetime import datetime
import shutil
import pyautogui
options = webdriver.IeOptions()
options.ignore_protected_mode_settings = True
options.add_argument('--disable-notifications')
driver = webdriver.Ie(options=options)
driver.get("http://192.168.18.99")
wait = WebDriverWait(driver, 20)
username_input = wait.until(EC.element_to_be_clickable((By.ID, "username")))
if username_input.get_attribute('value') == '':
username_input.send_keys(".....")
password_input = driver.find_element(By.ID, "password")
password_input.send_keys(".....")
login_button = driver.find_element(By.ID, "b_login")
login_button.click()
config_tab = wait.until(EC.element_to_be_clickable((By.ID, "b_config")))
config_tab.click()
wait.until(EC.element_to_be_clickable((By.ID, "m_it_menu")))
m_it_menu = driver.find_element(By.ID, "m_it_menu")
if "ui-menu-item" in m_it_menu.get_attribute("class"):
m_it_menu.click()
blackwhite_list_tab = wait.until(EC.element_to_be_clickable((By.ID, "m_blackwhite_list")))
blackwhite_list_tab.click()
bw_tab_title_white_tab = wait.until(EC.element_to_be_clickable((By.ID, "bw_tab_title_white")))
bw_tab_title_white_tab.click()
export_button = wait.until(EC.element_to_be_clickable((By.ID, "bw_export_white")))
export_button.click()
confirm_button = wait.until(EC.element_to_be_clickable((By.ID, "bw_exportEncrypt_confirm")))
confirm_button.click()
time.sleep(3)
pyautogui.write('C:\Users\...')
pyautogui.press('enter')
print("File saved successfully")
driver.quit()
I’ve been trying to mess around with IEDriver versions, TabProcGrowth values and AutoIt but nothing seems to work for me.
Can anyone help me with this issue?
s4lado is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.