1

enter image description here

Hi tried something like it was working before

driver.find_element_by_xpath("//*[@id="loginForm"]/div/div[1]/input").send_keys("[email protected]")

but now it gives error

Message: no such element: Unable to locate element: {"method":"xpath","selector":"//div[@class="inputs"]//input[@name="email"]"}
2

2 Answers 2

2

You can try with name :

driver.find_element_by_name("email").send_keys("[email protected]")  

in case you want to introduce webDriverWait :

wait = WebDriverWait(driver,10)

wait.until(EC.element_to_be_clickable((By.NAME, 'email'))).send_keys("[email protected]")  

Note that you will have to imports these :

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC 

UPDATE1:

You are in iframe , you will have to switch the focus of your web driver to default content and then you can interact with it:

driver.switch_to.default_content()

wait.until(EC.element_to_be_clickable((By.NAME, 'email'))).send_keys("[email protected]")
Sign up to request clarification or add additional context in comments.

8 Comments

Thanks but getting TimeoutException
Well , Are you handling the advertisement pop up?
Yes I am handling advertisement popup
Becaue I do not have full code for handling the advertisement pop up , So I am clicking on cross button manually , and then the code provide by me works well.
Can you share the code for handling the pop up , I will inject that with my current code.
|
1

To send a character sequence to the Email field you need to induce WebDriverWait for the desired element to be clickable and you can use either of the following solution:

  • CSS_SELECTOR:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input[name='email']"))).send_keys("[email protected]")
    
  • XPATH:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@name='email']"))).send_keys("[email protected]")
    

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

1 Comment

Hi Debanjan I am getting Timeout Exception as I am logging in after handing advertisement popup as answered by you here stackoverflow.com/questions/51590374/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.