Skip to content

Instantly share code, notes, and snippets.

@andreasneuber
Last active November 6, 2021 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreasneuber/e1feafe52cebd4a73a8cd32ec2d944c9 to your computer and use it in GitHub Desktop.
Save andreasneuber/e1feafe52cebd4a73a8cd32ec2d944c9 to your computer and use it in GitHub Desktop.
Codeception - grab all urls with specific segment from a page
private function extract_all_page_links( AcceptanceTester $I ): array {
$I->amOnPage( '/example/' );
$url = $this->base_url . 'example/';
$aLinks = $I->grabMultiple( "//a[contains(@href,'{$url}' )]", 'href' );
return array_unique( $aLinks );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment