Open Dherlou opened 2 years ago
can you check what is the type of $crawler->filterXPath('//input[@id="password"]')
?
If is something related to "form field" then maybe can you try this getValue()
method on it? : https://github.com/symfony/panther/blob/main/src/DomCrawler/Field/FormFieldTrait.php#L47
But please also do: $crawler = $this->client->refreshCrawler();
And can you pause for 1 second before refreshing crawler? (using sleep(1)
)
The type is 'object' and the class is 'Symfony\Component\Panther\DomCrawler\Crawler'. The field does exist and is updated, as I can verify it with the JavaScript injection line.
I was able to get the value of the password field with $crawler->filter('#submit')->form()->getValues()['_password'];
. I am just wondering, why this works and $crawler->filterXPath('//input[@id="password"]')->html()
is not... Adding the 1s sleep followed by the refreshCrawler() did not change anything by its own.
(Edit: The field id is "password" and the name is "_password".)
Hey there,
I want to assert the new document state after interacting with the document.
I set the test client and web server up like this in my test super class, which uses the PantherTestCaseTrait:
Then I execute a simple test script, where an input field should be filled and the new value asserted:
The last assertion fails, because '' != 'dummy', so the crawler does not have the input field filled. However, if I use the commented line for the assertion by retrieving the value directly from JavaScript, the test succeeds. What am I doing wrong?