Back to Browsershot

Changing the value of a dropdown

docs/miscellaneous-options/changing-the-value-of-a-dropdown.md

5.3.0506 B
Original Source

You can change the value of a dropdown on the page (you can use this to change form select fields).

php
Browsershot::url('https://example.com')
    ->selectOption('#selector1', '100')

You can combine selectOption, type and click to create a screenshot of a page after submitting a form:

php
Browsershot::url('https://example.com')
    ->type('#firstName', 'My name')
    ->selectOption('#state', 'MT')
    ->click('#submit')
    ->delay($millisecondsToWait)
    ->save($pathToImage);