# coding:utf-8
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
from time import sleep
def test1():
url = 'https://www.baidu.com/'
dr = webdriver.Firefox()
dr.get(url)
loc1 = (By.ID,'kw')
WebDriverWait(dr,10).until(expected_conditions.visibility_of_element_located(loc1))
dr.find_element_by_id('kw').send_keys('selenium')
dr.find_element_by_id('su').click()
sleep(3)
loc2 = (By.XPATH,'/html/body/div[1]/div[2]/div/a[3]')
WebDriverWait(dr, 10).until(expected_conditions.element_to_be_clickable(loc2))
dr.find_element_by_xpath('/html/body/div[1]/div[2]/div/a[3]').click()
if __name__=="__main__":
test1()