I would like to create a code that opens a web page and fills in the fields automatically according to the instructions. But I encounter a problem with the webdriver attributes
I'll give you the code:
import random
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
driver.get("https://www.facebook.com")
username = str(random.randint(0, 999999999)).zfill(5)
password = username[:-2]
search_box = driver.find_element_by_name("email")
search_box.send_keys(username)
search_box = driver.find_element_by_name("pass")
search_box.send_keys(password)
search_box = driver.find_element_by_name("login")
search_box.click()
time.sleep(5)
I wanted to find the username label to put a random number So I tried search_box = driver.find_element_by_name("email") but I got an error
here is the error:
search_box = driver.find_element_by_name("email")
AttributeError: 'WebDriver' object has no attribute 'find_element_by_name'