The element should be unique in nature, based on the HTML that you've shared, can you check this CSS or XPATH
XPATH:
//input[@class='native-input sc-ion-input-md' and @type='email' and@name='ion-input-0']
CSS_SELECTOR:
input[class='native-input sc-ion-input-md'][type='email'][name='ion-input-0']
Please check in the dev tools
(Google chrome) if we have unique entry in HTML DOM
or not.
Steps to check:
Press F12 in Chrome
-> go to element
section -> do a CTRL + F
-> then paste the xpath/css
and see, if your desired element
is getting highlighted with 1/1
matching node.
If they happen to be unique in nature you can try with the below code:
Code1:
wait = WebDriverWait(driver, 30)
input = wait.until(EC.visibility_of_element_located((By.XPATH, "//input[@class='native-input sc-ion-input-md' and @type='email' and@name='ion-input-0']")))
input.send_keys('the string that you want to send')
Code2:
wait = WebDriverWait(driver, 30)
input = wait.until(EC.visibility_of_element_located((By.XPATH, "//input[@class='native-input sc-ion-input-md' and @type='email' and@name='ion-input-0']")))
driver.execute_script("arguments[0].setAttribute('value', 'the string that you want to send')", input)
Imports:
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC