Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 89a6ce7

Browse files
committed
Workaround in example script for Selenium bug (fixes #402)
1 parent 8375294 commit 89a6ce7

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

example.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
$capabilities = DesiredCapabilities::firefox();
1414
$driver = RemoteWebDriver::create($host, $capabilities, 5000);
1515

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

1919
// adding cookie
2020
$driver->manage()->deleteAllCookies();
@@ -31,17 +31,24 @@
3131
);
3232
$link->click();
3333

34+
// wait until the page is loaded
35+
$driver->wait()->until(
36+
WebDriverExpectedCondition::titleContains('About')
37+
);
38+
3439
// print the title of the current page
3540
echo "The title is '" . $driver->getTitle() . "'\n";
3641

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

40-
// Search 'php' in the search box
41-
$input = $driver->findElement(
42-
WebDriverBy::id('q')
43-
);
44-
$input->sendKeys('php')->submit();
45+
// write 'php' in the search box
46+
$driver->findElement(WebDriverBy::id('q'))
47+
->sendKeys('php');
48+
49+
// submit the form
50+
$driver->findElement(WebDriverBy::id('submit'))
51+
->click(); // submit() does not work in Selenium 3 because of bug https://github.com/SeleniumHQ/selenium/issues/3398
4552

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

0 commit comments

Comments
 (0)