symfony / panther

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

InvalidArgumentException: The "Symfony\Component\Panther\DomCrawler\Crawler::clear" method is not supported when using WebDriver. #72

Open ChangePlaces opened 6 years ago

ChangePlaces commented 6 years ago

I use the filter method to target elements, and I want to clear out the product title, and type "test title2":

$crawler->filter('#product_title')->clear()->sendKeys('test title2');

But this gives the error: InvalidArgumentException: The "Symfony\Component\Panther\DomCrawler\Crawler::clear" method is not supported when using WebDriver.

I instead have to use: $crawler->findElement(WebDriverBy::id('product_title'))->clear()->sendKeys('test title2');

I think this is an inconsistency which need addressing?

dunglas commented 6 years ago

Yes it can surely be easily fixed, a pr will be very appreciated!

ChangePlaces commented 6 years ago

the pr would be a rewrite and remove the goutte interface as clearly some of it works and some of it doesn't (the incorrect 200 status, this) - red flags for bad use of an interface.

dunglas commented 6 years ago

This one should be an easy pick. As stated in the blog post, and in the version number, it's still young... There are things to improve. Removing the browserkit interface makes no sense, it's the whole purpose of the project. Use the PHP WebDriver API or Puppeteer directly in this case.

bastien70 commented 4 years ago

Any update about this ?