symfony / panther

A browser testing and web crawling library for PHP and Symfony
MIT License
2.91k stars 213 forks source link

NoSuchElementException: Unable to locate element: [name='registration\5B email\5D '] / underscore problem #535

Open AxelBriche opened 2 years ago

AxelBriche commented 2 years ago

Hello, with that basic code:

        $client = static::createPantherClient();
        $client->request('GET', '/registration');
        $client->submitForm("S'inscrire", [
            'email' => 'loremipsum@gmail.com'
        ]);

I have the error:

NoSuchElementException: Unable to locate element: [name='registration\5B email\5D ']

It's a problem with underscore "_" in field name.

If I use a name without "_", the error is solved. And the problem is only present on chrome.

$client = static::createPantherClient(['browser' => static::FIREFOX]); work like a temporary fix.

jmediatechnology commented 1 year ago

I had the same problem. In my case, the problem wasn't actually a problem. In my case Firefox Developer Edition Browser was acting differently in comparison to the normal classical Firefox Browser. I was expecting a specific element which would appear in Firefox Developer Edition. In the classical Firefox Browser that specific element was not appearing.