EyeWitness icon indicating copy to clipboard operation
EyeWitness copied to clipboard

[Requst] Custom Window Size

Open zero77 opened this issue 3 years ago • 1 comments

OS Used - ALL Information (architecture, linux flavor, etc.)

ALL

Pastebin link to error you are encountering

N/A

Expected behavior (vs. what you encountered)

Can you please give an option to set a custom window size. As sometimes screenshots are missing information or sometimes there is unnecessary information captured like webpage Ad banners and it would be niceto crop them out.

Any additional information

No

zero77 avatar Sep 26 '22 10:09 zero77

@zero77

No time to add the cmd arg and add to db for resume operations, but the below example will allow you to do this manually until it can be implemented properly. Deferring to @ChrisTruncer to ack or close request.

In selenium_module.py, add driver.set_window_size(1920,1080) before returning the driver (line ~80)

In headless, the height is dependent on rendering and will not be exact to the specified, however the width should return expected.

selenium_module.py:

    try:
        capabilities = DesiredCapabilities.FIREFOX.copy()
        capabilities.update({'acceptInsecureCerts': True})
        options = Options()
        options.add_argument("--headless")
        profile.update_preferences()
        driver = webdriver.Firefox(profile, capabilities=capabilities, options=options, service_log_path=cli_parsed.selenium_log_path)
        driver.set_page_load_timeout(cli_parsed.timeout)
        # ******** Adding below (before return driver) will set the window size.  *******
        driver.set_window_size(1920,1080)
        return driver

tested and worked as expected for 800x600 and 1920x1080, with caveat that height is render dependent.

Relkci avatar Nov 08 '22 06:11 Relkci