Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

selenium get response body python

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager #This lets users download latest version of chrome driver automatically
from bs4 import BeautifulSoup

chrome_options = Options()
chrome_options.add_argument("no-sandbox")
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("--headless")

driver = webdriver.Chrome(ChromeDriverManager().install(),options=chrome_options) #auto download or use cache of chrome driver
url = 'https://google.com'
driver.get(url)

html = driver.page_source
soup = BeautifulSoup(html, features='lxml')

print(soup)
 
PREVIOUS NEXT
Tagged: #selenium #response #body #python
ADD COMMENT
Topic
Name
9+9 =