Skip to content

Commit

Permalink
Workaround in example script for Selenium bug (fixes #402)
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraM committed Mar 16, 2017
1 parent 8375294 commit 89a6ce7
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions example.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
$capabilities = DesiredCapabilities::firefox();
$driver = RemoteWebDriver::create($host, $capabilities, 5000);

// navigate to 'http://docs.seleniumhq.org/'
$driver->get('http://docs.seleniumhq.org/');
// navigate to 'http://www.seleniumhq.org/'
$driver->get('http://www.seleniumhq.org/');

// adding cookie
$driver->manage()->deleteAllCookies();
Expand All @@ -31,17 +31,24 @@
);
$link->click();

// wait until the page is loaded
$driver->wait()->until(
WebDriverExpectedCondition::titleContains('About')
);

// print the title of the current page
echo "The title is '" . $driver->getTitle() . "'\n";

// print the URI of the current page
echo "The current URI is '" . $driver->getCurrentURL() . "'\n";

// Search 'php' in the search box
$input = $driver->findElement(
WebDriverBy::id('q')
);
$input->sendKeys('php')->submit();
// write 'php' in the search box
$driver->findElement(WebDriverBy::id('q'))
->sendKeys('php');

// submit the form
$driver->findElement(WebDriverBy::id('submit'))
->click(); // submit() does not work in Selenium 3 because of bug https://github.com/SeleniumHQ/selenium/issues/3398

// wait at most 10 seconds until at least one result is shown
$driver->wait(10)->until(
Expand Down

0 comments on commit 89a6ce7

Please sign in to comment.