Home > other >  Python Selenium Locating Element
Python Selenium Locating Element

Time:09-25

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

CodePudding user response:

Try this code, see if it works:

ele = driver.find_element_by_xpath("//*[@id='save-all-conditionally']")
ele.click()

CodePudding user response:

Not tested yet:

iframe = driver.find_elements_by_tag_name('iframe')
if len(iframe) == 1:
    driver.switch_to.frame(iframe[0])
    button = driver.find_element_by_id('save-all-conditionally')
    if button:
        button.click()

Since the iframe has no id get it by tag name, it should be one iframe use switch_to.frame to switch to the iframe content and get the button to click on it

  • Related