Skip to content

Instantly share code, notes, and snippets.

@auxiliary
Last active July 23, 2018 04:22
Show Gist options
  • Save auxiliary/3c421a6ece962962a609ef4762c29de3 to your computer and use it in GitHub Desktop.
Save auxiliary/3c421a6ece962962a609ef4762c29de3 to your computer and use it in GitHub Desktop.
Simple headless browser test for Tapestry
#!/usr/bin/env python3
import sys
import json
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
if __name__ == '__main__':
options = webdriver.ChromeOptions()
options.add_argument('--no-sandbox')
options.add_argument('--headless')
options.add_argument('--disable-web-security')
options.binary_location = '/usr/bin/chromium-browser'
driver = webdriver.Chrome('./chromedriver',
chrome_options=options,
desired_capabilities={"acceptInsecureCerts": True}
)
driver.set_window_size(2048, 2048)
url = sys.argv[1]
print("Testing", url)
driver.get(url)
element = WebDriverWait(driver, 1800).until(lambda x: x.find_element_by_id("done"))
for entry in driver.get_log('browser'):
print (entry)
driver.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment