This repository was archived by the owner on Mar 4, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change 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 ();
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
3540echo "The title is ' " . $ driver ->getTitle () . "' \n" ;
3641
3742// print the URI of the current page
3843echo "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 (
You can’t perform that action at this time.
0 commit comments