-
Notifications
You must be signed in to change notification settings - Fork 1
/
easy_cnblogs.py
49 lines (37 loc) · 1.56 KB
/
easy_cnblogs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# coding=utf8
import base_easy
import utils
from selenium.webdriver.common.keys import Keys
class Easy_Cnblogs(base_easy.Base_Easy):
search_key = "golang"
siteurl = "http://www.cnblogs.com/"
site_title = "cnblogs"
def cnblog_search(self, search_key=""):
self.driver.get(self.siteurl)
elem = self.driver.find_element_by_id("zzk_q")
search_key = self.search_key if search_key == "" else search_key
elem.send_keys(search_key)
elem.send_keys(Keys.ENTER)
return self.driver.page_source
def cnblog_search_golang(self):
self.select_driver_adapter()
page_info = self.cnblog_search('golang')
if 'golang' in page_info:
msg = "cnblog search work succes"
else:
msg = "cnblog search work failed"
utils.record_log(msg)
def cnblog_search_nosql(self):
page_info = self.cnblog_search('nosql')
if 'nosql' in page_info:
msg = "cnblog search work succes"
else:
msg = "cnblog search work failed"
utils.record_log(msg)
def save_upload_search_nosql(self):
self.cnblog_search_nosql()
self.save_and_uload_snapshot()
def run_jobs(self):
# self.cnblog_search_golang()
# self.cnblog_search_nosql()
self.save_upload_search_nosql()