WWW-Mechanize-Chrome

 view release on metacpan or  search on metacpan

README.mkdn  view on Meta::CPAN

    executable if you are having issues. You can also set the name of the executable
    file with the `$ENV{CHROME_BIN}` environment variable.

    Additional arguments for the command are also read from the `<$ENV{WWW_MECHANIZE_CHROME_ARGS}`>
    variable and prepended to the `launch_arg` array.

- **cleanup\_signal**

        cleanup_signal => 'SIGKILL'

    The signal that is sent to Chrome to shut it down. On Linuxish OSes, this
    will be `TERM`, on OSX and Windows it will be `KILL`.

- **start\_url**

        start_url => 'http://perlmonks.org'  # Immediately navigate to a given URL

    By default, the browser will open with a blank tab. Use the `start_url` option
    to open the browser to the specified URL. More typically, the `->get`
    method is use to navigate to URLs. Using `start_url` means you don't
    get notified when the URL has finished loading.

- **launch\_arg**

    Pass additional switches and parameters to the browser's executable:

        launch_arg => [ "--some-new-parameter=foo", "--another-option" ]

    Examples of other useful parameters include:

        '--start-maximized',
        '--window-size=1280x1696'
        '--ignore-certificate-errors'

        '--disable-web-security',
        '--allow-running-insecure-content',

        '--load-extension'
        '--no-sandbox'

    If you don't want the browser to use your OS password store, add:

        '--password-store=basic'

    Also see
    [https://peter.sh/experiments/chromium-command-line-switches/](https://peter.sh/experiments/chromium-command-line-switches/)
    for a list of command line arguments that Chrome actually has in the source
    code.

    Additional arguments for the command are also read from the
    `<$ENV{WWW_MECHANIZE_CHROME_ARGS}`>
    variable and prepended to the `launch_arg` array.

- **separate\_session**

        separate_session => 1   # create a new, empty session

    This creates an empty, fresh Chrome session without any cookies. Setting this
    will disregard any **data\_directory** setting.

- **incognito**

        incognito => 1   # open the browser in incognito mode

    Defaults to false. Set to true to launch the browser in incognito mode.

    Most likely, you want to use **separate\_session** instead.

- **data\_directory**

        data_directory => '/path/to/data/directory'  #  set the data directory

    By default, an empty data directory is used. Use this setting to change the
    base data directory for the browsing session.

        use File::Temp 'tempdir';
        # create a fresh Chrome every time
        my $mech = WWW::Mechanize::Chrome->new(
            data_directory => tempdir(CLEANUP => 1 ),
        );

    Using the "main" Chrome cookies:

        my $mech = WWW::Mechanize::Chrome->new(
            data_directory => '/home/corion/.config/chromium',
        );

- **profile**

        profile => 'ProfileDirectory'  #  set the profile directory

    By default, your current user profile directory is used. Use this setting
    to change the profile directory for the browsing session.

    You will need to set the **data\_directory** as well, so that Chrome finds the
    profile within the data directory. The profile directory/name itself needs
    to be a single directory name, not the full path. That single directory name
    will be relative to the data directory.

- **wait\_file**

        wait_file => "$tempdir/CrashpadMetrics-active.pma"

    When shutting down, wait until this file does not exist anymore or can be
    deleted. This can help making sure that the Chrome process has really shut
    down.

- **startup\_timeout**

        startup_timeout => 5  # set the startup timeout value

    Defaults to 20, the maximum number of seconds to wait for the browser to launch.
    Higher or lower values can be set based on the speed of the machine. The
    process attempts to connect to the browser once each second over the duration
    of this setting.

- **driver**

        driver => $driver_object  # specify the driver object

    Use a [Chrome::DevToolsProtocol::Target](https://metacpan.org/pod/Chrome%3A%3ADevToolsProtocol%3A%3ATarget) object that has been manually constructed.

- **report\_js\_errors**

        report_js_errors => 1  # turn javascript error reporting on



( run in 1.893 second using v1.01-cache-2.11-cpan-5b529ec07f3 )