@@ -0,0 +1,1141 @@
+from selenium import webdriver%0Afrom selenium.webdriver.common.by import By%0Afrom pprint import pprint%0A%0A%0Aurl = 'https://gushi.tw'%0Adriver = webdriver.PhantomJS()%0Adriver.maximize_window()%0Adriver.implicitly_wait(10)%0Adriver.get('file:///home/afun/github/dsc-crawling/Lesson3_non_static_crawling/03_selenium/webdriver/gushi.html')%0A# print(driver.find_element(By.XPATH, '//div').get_attribute('outerHTML'), '%5Cn----------%5Cn')%0A# print(driver.find_element(By.XPATH, '//div/div').get_attribute('outerHTML'), '%5Cn----------%5Cn')%0A# print(driver.find_element(By.XPATH, '//*%5B@id=%22menu-item-33737%22%5D').get_attribute('outerHTML'), '%5Cn---------%5Cn')%0A# print(driver.find_element(By.XPATH, '//*%5B@id=%22menu-item-33737%22%5D/..').get_attribute('outerHTML'), '%5Cn---------%5Cn')%0A# print(driver.find_element(By.XPATH, '//*%5B@id=%22menu-item-33737%22%5D/../li%5B3%5D').get_attribute('outerHTML'), '%5Cn---------%5Cn')%0A# print(driver.find_element(By.XPATH, '//*%5B@id=%22menu-item-33737%22%5D/../li%5Blast()%5D').get_attribute('outerHTML'), '%5Cn---------%5Cn')%0A# print(driver.find_element(By.XPATH, '//*%5B@id=%22menu-item-33737%22%5D/../li%5Bposition() %3E 2%5D').get_attribute('outerHTML'), '%5Cn---------%5Cn')%0Adriver.quit()%0A

test code