Advertisement
Guest User

Untitled

a guest
Oct 24th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. import bs4,requests,time,json,urllib3,re,time
  2. from selenium import webdriver
  3. from selenium.webdriver.common.keys import Keys
  4. from selenium.webdriver.common.action_chains import ActionChains
  5.  
  6. driver = webdriver.Chrome('./chromedriver')
  7. driver.get('https://www.coolpc.com.tw/evaluate.php')
  8. html = driver.page_source
  9. soup = bs4.BeautifulSoup(driver.page_source, 'html.parser')
  10. #fp = open('index.html', 'w', encoding='utf-8')
  11. #fp.write(soup.prettify())
  12. #print('寫入檔案index.html')
  13. #fp.close()
  14.  
  15. actions = ActionChains(driver)
  16. actions.move_by_offset(200, 100).click()
  17. actions.perform()
  18.  
  19. hp = driver.find_element_by_css_selector('#tbdy > tr:nth-child(1) > td:nth-child(3) > select > optgroup:nth-child(2) > option:nth-child(1)')
  20. time.sleep(1)
  21. hp.click()
  22. time.sleep(2)
  23. driver.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement