Obviously, your selectors (provided in comments) won't work as:
- You cannot use
find_element_by_class_name() with compound class names
- You cannot apply
find_element_by_link_text() to button elements (but a only)
Try to use following code and let me know if exception still occurs:
driver.find_element_by_xpath('//button[text()="I Agree"]').click()
You also might need to add some time to wait until your button become clickable:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
wait = WebDriverWait(driver, 10)
wait.until(EC.element_to_be_clickable((By.XPATH, '//button[text()="I Agree"]'))).click()
Another way to solve NoSuchElementException is to check whether you r element located inside frame/iframe block. If so, you need to switch to that frame before handling target element:
driver.switch_to_frame('frame_name_or_id')