'list' object has no attribute 'click' 'list' object has no attribute 'click' selenium selenium

'list' object has no attribute 'click'


My 2c using Expected Conditions (waits):

from selenium import webdriverfrom selenium.webdriver.support import expected_conditions as ecfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitdriver = webdriver.Firefox()wait = WebDriverWait(driver, 10)driver.maximize_window()driver.get('https://site.tld')el = wait.until(EC.element_to_be_clickable((By.XPATH, '//button[text()="Close subscription dialog"]')))el.click()

Based on your comment, you may want to use the following code after "click is executed" and which opens a new tab:

wait.until(EC.number_of_windows_to_be(2)) # wait for 2 tabs (windows) to be opendriver.switch_to_window(driver.window_handles[1]) # switch to newly opened tab


It is because your a trying to find the elements by

browser.find_elements_by path

Note that you can see elements. Elements is a list.It is pluralTry this:

 browser.find_element_by_path

And then use closebutton.click()


I found the answer. As there is a space you should use css selector. The important things are the points(.)

close_button = browser.find_element_by_css_selector('.prefix-overlay-close.prefix-overlay-action-later')close_button.click()

It worked for me in your given website. Please check once