Selenium Python Script throws no element error exception even though the x path is right?
Question: 
    from selenium import webdriver
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    from selenium.webdriver.common.keys import Keys
    driver=webdriver.Chrome()
    driver.get("https://paytm.com/")
    driver.maximize_window()
    driver.find_element_by_class_name("login").click()
    driver.implicitly_wait(10)
    driver.find_element_by_xpath("//md-input-container[@class='md-default-theme md-input-invalid']/input[@id='input_0']").send_keys("99991221212")
    

In the above code, I have verified the xpath using fire bug its highlighting
the correct element. But when the script run its failing? Can you help me
folks?


Answer: In selenium each frame is treated individually. Since the login is in a
separate `iframe` element, you need to switch to it first using:

    
    
    iframe = driver.find_elements_by_tag_name('iframe')[0]
    driver.switch_to_frame(iframe) 
    

**Before** trying to interact with it's elements.

Or in this case, you would wait for the frame to exist, and it would be:

    
    
    from selenium import webdriver
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    
    driver = webdriver.Chrome()
    driver.get("https://paytm.com/")
    driver.maximize_window()
    
    wait = WebDriverWait(driver, 10)
    
    wait.until(EC.visibility_of_element_located((By.CLASS_NAME, "login"))).click()
    wait.until(EC.frame_to_be_available_and_switch_to_it((By.TAG_NAME, "iframe")))
    
    _input = wait.until(EC.visibility_of_element_located((By.ID,"input_0")))
    _input.send_keys("99991221212")
    

