2

Writing a parser for https://myip.ms I can't register. I wrote that the parser would open the registration window, but I can't enter any data, an error occurs selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
import time
from selenium.webdriver.common.action_chains import ActionChains

driver = webdriver.Chrome(ChromeDriverManager().install())
driver.get("https://myip.ms/#a")

button = driver.find_elements_by_xpath('//*[@id="fixed_width_page"]/table/tbody/tr/td/table[1]/tbody/tr/td[2]/div[2]/span[2]/a[1]')
if len(button) > 0:
    button[0].click()
driver.implicitly_wait(50)
print('Работает')

login = driver.find_element_by_xpath('/html/body/div[6]/div[2]/div/form/table/tbody/tr[1]/td[2]/span/input')
print('Работает 2')
time.sleep(10)

driver.implicitly_wait(50)
print(login)
if len(login) > 0:
    print('tut')
login.send_keys('фвыфы')
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

1 Answers1

1

To send a character sequence to the Email field you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

  • Using XPATH:

    driver.get("https://myip.ms/#a")
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.LINK_TEXT, "Login"))).click()
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@aria-describedby='uidialog']//input[@id='email' and @name='email']"))).send_keys("Коля Нарушев")
    
  • 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
    
  • Browser Snapshot:

myip

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352