Question: On website <https://www.expedia.com/> i need to type on the Leaving from colum,but it only gives me an error:AttributeError: 'NoneType' object has no attribute 'send\_keys'. How can i write on Leaving from?

```
import time

from selenium import webdriver

driver=webdriver.Chrome(executable_path="D:\ChromeDriverExtracted\chromedriver")

driver.implicitly_wait(5)

driver.maximize_window()

driver.get("https://www.expedia.com/")
driver.find_element_by_xpath("//span[text()='Flights']").click()

time.sleep(2)
driver.find_element_by_xpath("//*[@id=wizard-flight-tab-roundtrip]/div[2]/div[1]/div/div[1]/div/div/div/button").send_keys("SFO")

```

Answer: 
To send a *character sequence* to the element you need to induce [WebDriverWait](https://stackoverflow.com/questions/59130200/selenium-wait-until-element-is-present-visible-and-interactable/59130336#59130336) for the [`element_to_be_clickable()`](https://stackoverflow.com/questions/65140218/selenium-not-able-to-click-on-get-data-button-on-using-python/65141861#65141861) and you can use either of the following [Locator Strategies](https://stackoverflow.com/questions/48369043/official-locator-strategies-for-the-webdriver/48376890#48376890):

* Using CSS\_SELECTOR:

```
driver.get("https://www.expedia.com/")
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "a[aria-controls='wizard-flight-pwa']>span"))).click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button[aria-label='Leaving from']"))).click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input#location-field-leg1-origin"))).send_keys("SFO")

```
* Using XPATH:

```
driver.get("https://www.expedia.com/")
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//a[@aria-controls='wizard-flight-pwa']//span"))).click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//button[@aria-label='Leaving from']"))).click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@id='location-field-leg1-origin']"))).send_keys("SFO")

```
* Browser Snapshot:

[![expedia_from_SFO](https://i.stack.imgur.com/V9cZd.png)](https://i.stack.imgur.com/V9cZd.png)

* **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

```
It seems like your last "find\_element\_by\_xpath" does not correctly locate the element you are looking for. An xpath that does locate your element is

```
"//input[@id='location-field-leg1-origin-input']"

```

I don't think this will completely solve your problem though. One thing is that you need to click on this element rather than simply send keys to it. You need to open the modal where you actually enter and select the airport you are leaving from.