Manipulate select outside a form with DomCrawler

38 views Asked by At

Symfony's DomCrawler documentation indicates how to change a select value within a form: https://symfony.com/doc/5.4/components/dom_crawler.html#forms.

I am used to Laravel Testing where you can just select a input and change the value: https://laravel.com/docs/9.x/dusk#dropdowns.

I can't seem to find how to do that in Symfony or if it is even possible. Given a select input like this...

<div>
    <label>Select the option</label>
    <select>
        <option value=1>First</option>
        <option value=2>Second</option>
    </select>
</div>

...where I can already select any of the components with XPath, how can I modify with DomCrawler (Or any other easily integrated way in Symfony Testing) the selected option without being the select in a form?

0

There are 0 answers