robotframework / robotframework/SeleniumLibrary
Capture Fullpage Screenshot
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 1.5k
- Fork
- 787
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
This is not a bug, but rather a new feature.
Often the browser page is longer that is shown and the user needs to scroll down to see the rest of the page.
Robot Framework often takes a screenshot on failure, but the screenshot captured only shows half of the page and might not include the problematic area.
It would be nice to have a keyword that captures a whole length image.
This is my python script to implement such functionality
def capture_fullpage_screenshot(url):
""" Creating a Full-Page screenshot.
Use this keyword for debugging purposes.
Creates an image called full_page_screenshot.png.
"""
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
options.add_argument("enable-automation")
options.add_argument("--headless")
options.add_argument("--no-sandbox")
options.add_argument("disable-infobars")
options.add_argument("--disable-extensions")
options.add_argument("--disable-gpu")
driver = webdriver.Chrome(options=options)
current_window = driver.get_window_size()
driver.get(url)
time.sleep(12)
height = driver.execute_script("return document.body.scrollHeight")
driver.set_window_size(1920, height)
driver.save_screenshot("full_page_screenshot.png")
driver.set_window_size(current_window["width"], current_window["height"])
However, it is not yet properly working, as it does not work inside docker.
And it has a hardcoded file name.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dallo script Python nell’issue ed esamina gli entry point esistenti delle keyword per gli screenshot e la configurazione di esecuzione di Docker. La funzionalità è completa quando una keyword acquisisce l’intera pagina, funziona all’interno di Docker e accetta un nome file di output invece di usare il nome hardcoded full_page_screenshot.png.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- testing-qa
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 42/100