[python]An example of get web page by selenium

2021-8-17 写技术

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')

browser = webdriver.Chrome(chrome_options=chrome_options)
mainUrl = "http://log.anycle.com"
browser.get(mainUrl)
print(f"browser text = {browser.page_source}")
browser.quit()

标签: python

发表评论:

Powered by anycle 湘ICP备15001973号-1