From 69ee03791a0c7404d2b04eed539ca234df0f7d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Sat, 13 Apr 2019 02:23:05 +0200 Subject: [PATCH] Added Selenium --- README.md | 14 ++++++++++++++ index.html | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/README.md b/README.md index 036339f..d139cfc 100644 --- a/README.md +++ b/README.md @@ -1808,6 +1808,20 @@ Scraping ('https://www.python.org/', '3.7.2') ``` +### Selenium +**Library for scraping dynamically generated web content.** + +```python +# $ brew cask install chromedriver +# $ pip3 install selenium +>>> from selenium import webdriver +>>> driver = webdriver.Chrome() +>>> driver.get(url) +>>> xpath = '//*[@id="mw-content-text"]/div/table[1]/tbody/tr[7]/td/div' +>>> driver.find_element_by_xpath(xpath).text.split()[0] +'3.7.2' +``` + Web --- diff --git a/index.html b/index.html index 1cf24b9..39742c2 100644 --- a/index.html +++ b/index.html @@ -1483,6 +1483,17 @@ logger.<level>('A logging message') >>> link, ver ('https://www.python.org/', '3.7.2') +

Selenium

+

Library for scraping dynamically generated web content.

+
# $ brew cask install chromedriver
+# $ pip3 install selenium
+>>> from selenium import webdriver
+>>> driver = webdriver.Chrome()
+>>> driver.get(url)
+>>> xpath  = '//*[@id="mw-content-text"]/div/table[1]/tbody/tr[7]/td/div'
+>>> driver.find_element_by_xpath(xpath).text.split()[0]
+'3.7.2'
+

#Web

# $ pip3 install bottle
 from bottle import run, route, post, template, request, response