#-*- coding:utf8 -*- # 导入selenium2中的webdriver库 from time import sleep from selenium import webdriver from selenium.webdriver.chrome.options import Options options = Options() options.add_argument('--headless') # 实例化出一个Firefox浏览器 driver = webdriver.Chrome(options=options) # 设置浏览器窗口的位置和大小 driver.set_window_position(20,40) driver.set_window_size(1100,700) driver.get("https://www.yeves.cn/login") driver.add_cookie({'domain': 'www.yeves.cn' , 'httpOnly': True, 'name': 'ci_session', 'path': '/', 'secure': False, 'value': '6potqjo62967esimp4dtko3a51'}) driver.add_cookie({'domain': 'www.yeves.cn' , 'httpOnly': True, 'name': 'userInfo', 'path': '/', 'secure': False, 'value': 'wang%22%2C%22password%22%3A%22199f86bbeade937163455a59da9b285f%22%2C%22face%22%3A%22%5C%2Fupload%5C%2Fuser_info%5C%2F20181018151425_6671_300.jpeg%22%2C%22create_time%22%3A%220000-00-00+00%3A00%3A00%22%2C%22update_time%22%3Anull%2C%22delete_time%22%3A%222018-10-18+18%3A25%3A56%22%2C%22is_del%22%3A%221%22%7D'}) driver.get("https://www.yeves.cn/admin") print(driver.get_cookies()) print(driver.current_url) # 退出窗口 sleep(4) driver.quit()