I have a lot of 'h2' elements with 'a' inside. All I want is just get all the 'a' in the 'h2'
when I try something like this:
public function testBreakingNewsH2(){
$this->url('index.php');
$h2Elements = $this->byCssSelector('h2')->byCssSelector('a')->text();
$this->assertEquals('Breaking News', $h2Elements);
}
I get only the first 'a' inside 'h2'. I need to check that all 'h2' links are exists (get all 'h2' elements that contains 'a') I tried something like this:
public function testHomePgaeH2(){
$this->url('index.php');
$h2Elements = $this->elements($this->using('css selector')->value('h2'));
$this->assertContains('Breaking News', $h2Elements);
$this->assertContains('Analysis', $h2Elements);
$this->assertContains('Calendar', $h2Elements);
$this->assertContains('Studies', $h2Elements);
}
this not works, this is the best example that I found for my issue. of course I can try something like this:
$this->assrtRegExp('/xxxx/i', $this->source());
but I want make it clean as possible without taking all the source.
please advise, thanks.