How can I get the page source, without showing the page opened, using selenium with chromedriver and python?
<p>I'm using selenium with Chrome driver; How can I get the page source, without showing  the page opened? What I should specify in webdriver.ChromeOptions()?
Here the code:</p>

<pre><code>from selenium.common.exceptions import WebDriverException
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument("???")
bowser = webdriver.Chrome(chrome_options=chrome_options)


browser = webdriver.Chrome() 
try:
    browser.get("www.google.com")
    html_content = browser.page_source
    #do stuff
    browser.quit()
except WebDriverException:
    print "Invalid URL"
</code></pre>

<p>You should not use <code>ChromeDriver</code> but some headless Webdriver like <code>HtmlUnitDriver</code>, explained <a href="http://www.seleniumhq.org/docs/03_webdriver.jsp#htmlunit-driver" rel="nofollow">here</a></p>

python selenium selenium-chromedriver