Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bs4,requests,time,json,urllib3,re,time
- from selenium import webdriver
- from selenium.webdriver.common.keys import Keys
- from selenium.webdriver.common.action_chains import ActionChains
- driver = webdriver.Chrome('./chromedriver')
- driver.get('https://www.coolpc.com.tw/evaluate.php')
- html = driver.page_source
- soup = bs4.BeautifulSoup(driver.page_source, 'html.parser')
- #fp = open('index.html', 'w', encoding='utf-8')
- #fp.write(soup.prettify())
- #print('寫入檔案index.html')
- #fp.close()
- actions = ActionChains(driver)
- actions.move_by_offset(200, 100).click()
- actions.perform()
- 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)')
- time.sleep(1)
- hp.click()
- time.sleep(2)
- driver.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement