Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5f94cec

Browse filesBrowse files
authored
Merge pull request symfony#107 from maidmaid/return-crawler
Client::waitFor() returns a crawler
2 parents 7464064 + bf50761 commit 5f94cec
Copy full SHA for 5f94cec

File tree

2 files changed

+5
-5
lines changed
Filter options

2 files changed

+5
-5
lines changed

‎src/Client.php

Copy file name to clipboardExpand all lines: src/Client.php
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Facebook\WebDriver\Exception\NoSuchElementException;
1717
use Facebook\WebDriver\Exception\TimeOutException;
1818
use Facebook\WebDriver\JavaScriptExecutor;
19-
use Facebook\WebDriver\Remote\RemoteWebElement;
2019
use Facebook\WebDriver\WebDriver;
2120
use Facebook\WebDriver\WebDriverBy;
2221
use Facebook\WebDriver\WebDriverCapabilities;
@@ -251,13 +250,15 @@ public function getCookieJar()
251250
* @throws NoSuchElementException
252251
* @throws TimeOutException
253252
*
254-
* @return RemoteWebElement
253+
* @return Crawler
255254
*/
256255
public function waitFor(string $cssSelector, int $timeoutInSecond = 30, int $intervalInMillisecond = 250)
257256
{
258-
return $this->wait($timeoutInSecond, $intervalInMillisecond)->until(
257+
$this->wait($timeoutInSecond, $intervalInMillisecond)->until(
259258
WebDriverExpectedCondition::visibilityOfElementLocated(WebDriverBy::cssSelector($cssSelector))
260259
);
260+
261+
return $this->crawler = $this->createCrawler();
261262
}
262263

263264
public function getWebDriver(): WebDriver

‎tests/ClientTest.php

Copy file name to clipboardExpand all lines: tests/ClientTest.php
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
namespace Symfony\Component\Panther\Tests;
1515

1616
use Facebook\WebDriver\JavaScriptExecutor;
17-
use Facebook\WebDriver\Remote\RemoteWebElement;
1817
use Facebook\WebDriver\WebDriver;
1918
use Facebook\WebDriver\WebDriverExpectedCondition;
2019
use Symfony\Component\BrowserKit\Client as BrowserKitClient;
@@ -45,7 +44,7 @@ public function testWaitFor()
4544
$client = self::createPantherClient();
4645
$crawler = $client->request('GET', '/waitfor.html');
4746
$c = $client->waitFor('#hello');
48-
$this->assertInstanceOf(RemoteWebElement::class, $c);
47+
$this->assertInstanceOf(Crawler::class, $c);
4948
$this->assertSame('Hello', $crawler->filter('#hello')->text());
5049
}
5150

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.