Skip to content

Commit 5373a76

Browse files
test page history
1 parent b6161d7 commit 5373a76

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

Scraper/Scrape/Crawler/BaseCrawler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function __construct(
7171
$this->javaScriptRequired = $javaScriptRequired;
7272

7373
$this->setBrowser($driver);
74-
$this->setPageHistory();
74+
//$this->setPageHistory();
7575
}
7676

7777
/**

Scraper/Scrape/Crawler/Types/GeneralCrawler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public function setNextPage($nextPageSelector = null)
109109
*/
110110
public function getPageHistory()
111111
{
112+
$this->setPageHistory();
112113
return $this->pageHistory;
113114
}
114115
}

Tests/Unit/Extractor/Types/MultipleRowExtractorTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,19 @@ public function testCanScrapeMultiplePage()
7979
true
8080
);
8181
$this->assertEquals(count($jsonData), $count);
82+
$historyData = $extractor->crawler->getPageHistory();
83+
$this->assertEquals(
84+
'http://localhost:1349/multiple-rows.php',
85+
$historyData[0]['url']
86+
);
87+
$this->assertEquals(
88+
'http://localhost:1349/multiple-rows.php?page=1',
89+
$historyData[1]['url']
90+
);
91+
$this->assertEquals(
92+
'http://localhost:1349/multiple-rows.php?page=2',
93+
$historyData[2]['url']
94+
);
8295
}
8396

8497
public function testCrawlingHaltsIfHashMatches()

0 commit comments

Comments
 (0)