---
# System prepended metadata

title: fb login 2

---

# fb login 2

```python=
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options


url='https://www.facebook.com'

option = Options()
option.add_experimental_option("prefs", { 
    "profile.default_content_setting_values.notifications": 1 
})

driver=webdriver.Chrome(chrome_options=option, executable_path=r'/usr/local/bin/chromedriver')

driver.get(url)

username = "你的帳號"
password = "你的密碼"

WebDriverWait(driver, 30).until(EC.presence_of_element_located((By.XPATH, '//*[@id="email"]')))
elem = driver.find_element_by_id("email")
elem.send_keys(username)

elem = driver.find_element_by_id("pass")
elem.send_keys(password)

elem.send_keys(Keys.RETURN)

```