Skip to content

Commit 0fd7a30

Browse files
committed
test
1 parent c8ddcef commit 0fd7a30

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Scripts/crawler/leetcode.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from selenium import webdriver
2+
3+
browser = webdriver.PhantomJS()
4+
url = 'https://leetcode.com/problems/house-robber/description/'
5+
browser.get(url)
6+
desc = browser.find_elements_by_xpath('//meta[@name="description"]')
7+
browser.find_element_by_xpath("//div[@class='Select-control']").click()
8+
print browser.find_element_by_xpath("//div[@class='Select-control']").text
9+
code_bak = browser.find_elements_by_xpath('//textarea[@name="lc-codemirror"]')
10+
code = browser.find_elements_by_xpath('//pre[@class=" CodeMirror-line "]/span')
11+
for t in desc:
12+
print t.get_attribute("content")
13+
for c in code:
14+
print c.text
15+
browser.quit()

0 commit comments

Comments
 (0)