I am trying to retrieve the html code of a site using a headless chrome driver. However I get a "permission denied" message. If I use a "regular" driver it all works fine.
Is there any way to bypass that?
It's my first post so I do apologize for any potential mistakes in formatting
from selenium import webdriver
#Headless driver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
driver1 = webdriver.Chrome(executable_path='./chromedriver', options=chrome_options,
service_args=['--verbose', '--log-path=/tmp/chromedriver.log'])
driver1.get('https://www.size.co.uk/')
html = driver1.page_source
html
The message I get is:
<html xmlns="http://www.w3.org/1999/xhtml"><head>\n<title>Access Denied</title>\n</head><body>\n<h1>Access Denied</h1>\n \nYou don\'t have permission to access "http://www.size.co.uk/" on this server.<p>\nReference #18.ac81655f.1548818550.73b12da\n\n\n</p></body></html>
Regular driver:
driver = webdriver.Chrome('./chromedriver')
driver.get('https://www.size.co.uk/')
html = driver.page_source
driver.quit()
html
Ideally, I'd like the output to be as in the latter case without having new windows popping up every couple seconds.