Below is my HTML code. I have tried by using xpath and still getting an exception of unable to locate element on a create account form. 

            Asked
            
        
        
            Active
            
        
            Viewed 62 times
        
    -1
            
            
         
    
    
        undetected Selenium
        
- 183,867
- 41
- 278
- 352
 
    
    
        Maham
        
- 91
- 1
- 12
- 
                    4You need to switch to the iframe first, then interact with the element. Please also post what have you tried, not only a picture. – lauda Mar 02 '20 at 12:54
1 Answers
-1
            
            
        As the the desired element is within an <iframe> so to invoke click() on the element you have to:
- Induce WebDriverWait for the desired frame_to_be_available_and_switch_to_it().
- Induce WebDriverWait for the desired element_to_be_clickable().
- You can use either of the following Locator Strategies: - Using - CSS_SELECTOR:- WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"iframe#accountFrame[src='/account/frame/login/create']"))) WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input[placeholder='Email'][data-test='create-account-email']"))).click()
- Using - XPATH:- WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.XPATH,"//iframe[@id='accountFrame' and @src='/account/frame/login/create']"))) WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//input[@placeholder='Email' and @data-test='create-account-email']"))).click()
 
- Note : You have to add the following imports : - from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC
Reference
You can find a couple of relevant discussions in:
 
    
    
        undetected Selenium
        
- 183,867
- 41
- 278
- 352
- 
                    
- 
                    I cant see any tick mark in your comment therefore I have marked it as a useful comment. – Maham Mar 05 '20 at 07:31