From a4f496b2bb3a09df6e6937744f2b71f787a7d676 Mon Sep 17 00:00:00 2001 From: JJJZXY <1522844911@qq.com> Date: Fri, 19 Mar 2021 20:30:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E7=AC=AC=E4=BA=8C?= =?UTF-8?q?=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\254\344\272\214\350\212\202/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/5\347\217\255/5\347\217\255_\345\274\240\345\205\264\351\233\250/\347\254\254\345\215\201\344\272\214\345\221\250 3.15 -3.21/\347\254\254\344\272\214\350\212\202/.keep" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/5\347\217\255/5\347\217\255_\345\274\240\345\205\264\351\233\250/\347\254\254\345\215\201\344\272\214\345\221\250 3.15 -3.21/\347\254\254\344\272\214\350\212\202/.keep" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/5\347\217\255/5\347\217\255_\345\274\240\345\205\264\351\233\250/\347\254\254\345\215\201\344\272\214\345\221\250 3.15 -3.21/\347\254\254\344\272\214\350\212\202/.keep" new file mode 100644 index 00000000..e69de29b -- Gitee From a82481a89d5fc263faf013c94c41d91c567bcae7 Mon Sep 17 00:00:00 2001 From: JJJZXY <1522844911@qq.com> Date: Fri, 19 Mar 2021 20:31:03 +0800 Subject: [PATCH 2/2] 0 --- .../test_selinum.py" | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/5\347\217\255/5\347\217\255_\345\274\240\345\205\264\351\233\250/\347\254\254\345\215\201\344\272\214\345\221\250 3.15 -3.21/\347\254\254\344\272\214\350\212\202/test_selinum.py" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/5\347\217\255/5\347\217\255_\345\274\240\345\205\264\351\233\250/\347\254\254\345\215\201\344\272\214\345\221\250 3.15 -3.21/\347\254\254\344\272\214\350\212\202/test_selinum.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/5\347\217\255/5\347\217\255_\345\274\240\345\205\264\351\233\250/\347\254\254\345\215\201\344\272\214\345\221\250 3.15 -3.21/\347\254\254\344\272\214\350\212\202/test_selinum.py" new file mode 100644 index 00000000..6d4935fa --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/5\347\217\255/5\347\217\255_\345\274\240\345\205\264\351\233\250/\347\254\254\345\215\201\344\272\214\345\221\250 3.15 -3.21/\347\254\254\344\272\214\350\212\202/test_selinum.py" @@ -0,0 +1,28 @@ +from selenium import webdriver +import time +from jd_code.parase import search + +driver_path = driver_path = r'chromedriver.exe' +chrome_options = webdriver.ChromeOptions() +chrome_options.add_argument("disable-blink-features=AutomationControlled") +browser = webdriver.Chrome(executable_path=driver_path, options=chrome_options) + +class jd_search: + + def sim_search(keyword, url): + browser.get(url) + search_input = browser.find_element_by_css_selector('input[aria-label="搜索"]') + search_input.send_keys(keyword) + search_button = browser.find_element_by_css_selector('button[aria-label="搜索"]') + search_button.click() + + def main(keyword, url): + jd_search.sim_search(keyword,url) + time.sleep(3) + item_array = search.parase_jd_item(browser.page_source) + print(item_array) + browser.close() + +if __name__ == "__main__": + jd_url = "https://www.jd.com/" + jd_search.main("鼠标", jd_url) -- Gitee