Skip to content

Instantly share code, notes, and snippets.

@generalredneck
Forked from anonymous/gist:3659504
Created September 6, 2012 19:09
Show Gist options
  • Save generalredneck/3659575 to your computer and use it in GitHub Desktop.
Save generalredneck/3659575 to your computer and use it in GitHub Desktop.
Feature: google
I want to search something on google
Scenario: Search something on google
Given I am on "/"
And I fill in "q" with "selenium"
When I press "Google Search"
And I click the first link
Then I should see "selenium"
public function iClickTheFirstLink()
{
$url = $this->getSession()->getCurrentUrl();
echo $url . " 1\n";
$driver = new \Behat\Mink\Driver\Selenium2Driver('firefox', 'http://www.google.com');
$session = new \Behat\Mink\Session($driver);
$session->start();
echo $session->getCurrentUrl() . " 2\n";
$session->visit($url);
$session->wait(3000);
echo $session->getCurrentUrl() . " 3\n";
$first_link = new NodeElement("//ol/li[1]/div/h3/a", $session);
$first_link->click();
$session->wait(3000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment