press kees with selenium python code example
Example: press kees with selenium python
# -*- coding: utf-8 -*-from selenium import webdriverfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.common.keys import Keysfrom selenium.webdriver.support import expected_conditions as ECfrom selenium.webdriver.support.wait import WebDriverWaitimport timebrowser=webdriver.Firefox()try: browser.get("https://en.wikipedia.org") print(browser.title) input=browser.find_element_by_id("searchInput") input.send_keys("Python") input.send_keys(Keys.ENTER) wait=WebDriverWait(browser,10) wait.until(EC.presence_of_element_located((By.ID,"content"))) print(browser.title) #print(browser.get_cookies()) #print(browser.page_source) time.sleep(10)finally: browser.close()