-1

The solution to this problem is not sending keys I want a solution, This is the website link: https://mahmoud-magdy.com/register

driver = webdriver.Firefox()
driver.get('https://mahmoud-magdy.com/register')
driver.find_element_by_id('first_name').send_keys(monster)
driver.find_element_by_id('last_name').send_keys(monster)
driver.find_element_by_name('phone').send_keys(phone)
driver.find_element_by_name('father_phone').send_keys(father_phone)
driver.find_element_by_name('email').send_keys(email)
driver.find_element_by_name('password').send_keys(password)
driver.find_element_by_name('password_confirmation').send_keys(password_confirmation)
driver.find_element_by_css_selector('button[type="submit"]').click()
print(phone)
driver.quit()

When I try to send keys to first name this problem appears

Prophet
  • 32,350
  • 22
  • 54
  • 79

1 Answers1

2

find_element_by_* methods no more supported by Selenium from Selenium 4.3 version.
You need to use a new syntax.
In your case it should be as following:

driver = webdriver.Firefox()
driver.get('https://mahmoud-magdy.com/register')
driver.find_element(By.ID, 'first_name').send_keys(monster)
driver.find_element(By.ID, 'last_name').send_keys(monster)
driver.find_element(By.NAME, 'phone').send_keys(phone)
driver.find_element(By.NAME, 'father_phone').send_keys(father_phone)
driver.find_element(By.NAME, 'email').send_keys(email)
driver.find_element(By.NAME, 'password').send_keys(password)
driver.find_element(By.NAME, 'password_confirmation').send_keys(password_confirmation)
driver.find_element(By.CSS_SELECTOR, 'button[type="submit"]').click()
print(phone)
driver.quit()

You will need this import for that:

from selenium.webdriver.common.by import By
Prophet
  • 32,350
  • 22
  • 54
  • 79