from selenium import webdriver options = webdriver.ChromeOptions() # chrome不显示照片 options.add_experimental_option("prefs", {'profile.default_content_settings.images': 2}) driver = webdriver.Chrome(chrome_options=options) try: # driver.set_page_load_timeout(10) driver.get('http://www.xxxx.com/') link_content = driver.find_elements_by_partial_link_text('xx') for items in link_content: print(items.text) print(items.get_attribute("href")) except: pass finally: driver.quit()
python 使用selenium打开chrome网页抓取信息