Python Selenium Locating Element

Issue

I’m trying to locate a element. But i can’t click on it. The id is ("save-all-conditionally")
but it’s not working if i click on it.
I tried css.selector, xpath and all other things but nothing is working!

Webiste picture

Solution

There are 2 frames, frame inside frame.
You would need to switch to parent frame then child frame.
here is the working code :

driver = webdriver.Chrome(ChromeDriverManager().install())
driver.maximize_window()
driver.get("https://www.gmx.net/consent-management/")
driver.implicitly_wait(10)
firstFrame = driver.find_element_by_xpath("//iframe[@class='permission-core-iframe']")
driver.switch_to.frame(firstFrame)
driver.switch_to.frame(0)
driver.find_element_by_xpath("//button[@id='save-all-conditionally']").click()

Answered By – Thiru

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published