0

I'm trying to use an if statement to close a popup window that appears from time to time when the browsing window comes up. I don't understand why, but I get an error.

import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select

driver = webdriver.Firefox('./')
driver.get("https://demo.seleniumeasy.com/")

if driver.find_element(By.CLASS_NAME ,"at4-close").is_displayed:

    driver.find_element(By.CLASS_NAME ,"at4-close").click()

else:
    time.sleep(4)
    
    tree_branch = driver.find_element(By.CLASS_NAME ,"tree-branch").click()
    input_forms = (driver.find_elements(By.LINK_TEXT, 'Input Forms')[1]).click()
    time.sleep(5)

here is the error:

 DeprecationWarning: firefox_profile has been deprecated, please pass in an Options object
jojo_hal
  • 21
  • 6
  • The error you presenting is not about the code you sharing. Please share your code block where you instantiating the `driver` especially where you use `firefox_profile` – Prophet Sep 14 '22 at 10:57
  • Please a) test your assumptions (is it because of the `if` statement? Did you try writing code that doesn't use `if`?); b) read error messages; c) [try to](https://meta.stackoverflow.com/questions/261592) understand them, for example by [using a search engine](https://duckduckgo.com/?q=DeprecationWarning%3A+firefox_profile+has+been+deprecated%2C+please+pass+in+an+Options+object). – Karl Knechtel Sep 14 '22 at 11:03

0 Answers0