Merge pull request #193 from seleniumbase/update-google-tour-example

Update Google tour example
This commit is contained in:
Michael Mintz 2018-08-18 19:34:45 -04:00 committed by GitHub
commit 8c48448927
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 48 deletions

View File

@ -1,4 +1,4 @@
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/SB_Logo16.png" title="SeleniumBase" height="48">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md) <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_2d1.png" title="SeleniumBase" height="48">
[<img src="https://img.shields.io/pypi/v/seleniumbase.svg" alt="Version" />](https://pypi.python.org/pypi/seleniumbase) [<img src="https://img.shields.io/badge/python-2.7,_3.*-22AADD.svg" alt="Python versions" />](https://pypi.python.org/pypi/seleniumbase) [<img src="https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master" alt="Build Status" />](https://travis-ci.org/seleniumbase/SeleniumBase) [<img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" alt="Join the Gitter Chat" />](https://gitter.im/seleniumbase/SeleniumBase) [<img src="http://img.shields.io/badge/license-MIT-22BBCC.svg" alt="MIT License" />](https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE) [<img src="https://img.shields.io/github/stars/seleniumbase/seleniumbase.svg" alt="GitHub Stars" />](https://github.com/seleniumbase/SeleniumBase/stargazers)<br /> [<img src="https://img.shields.io/pypi/v/seleniumbase.svg" alt="Version" />](https://pypi.python.org/pypi/seleniumbase) [<img src="https://img.shields.io/badge/python-2.7,_3.*-22AADD.svg" alt="Python versions" />](https://pypi.python.org/pypi/seleniumbase) [<img src="https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master" alt="Build Status" />](https://travis-ci.org/seleniumbase/SeleniumBase) [<img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" alt="Join the Gitter Chat" />](https://gitter.im/seleniumbase/SeleniumBase) [<img src="http://img.shields.io/badge/license-MIT-22BBCC.svg" alt="MIT License" />](https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE) [<img src="https://img.shields.io/github/stars/seleniumbase/seleniumbase.svg" alt="GitHub Stars" />](https://github.com/seleniumbase/SeleniumBase/stargazers)<br />

View File

@ -29,16 +29,17 @@ class MyTourClass(BaseCase):
self.open('https://google.com') self.open('https://google.com')
self.wait_for_element('input[title="Search"]') self.wait_for_element('input[title="Search"]')
self.create_tour(theme="dark") self.create_tour(theme="dark")
self.add_tour_step("Click to begin the Google Tour!", self.add_tour_step(
title="SeleniumBase Guided Tours") "Click to begin the Google Tour!", title="SeleniumBase Tours")
self.add_tour_step("Type in your search query here.", self.add_tour_step(
'input[title="Search"]') "Type in your search query here.", 'input[title="Search"]')
self.add_tour_step("Then click here to search!", self.add_tour_step(
'input[value="Google Search"]', "Then click here to search!", 'input[value="Google Search"]',
alignment="bottom", theme="arrows") alignment="bottom", theme="arrows")
self.add_tour_step("Or click here to see the top result.", self.add_tour_step(
'''[value="I'm Feeling Lucky"]''', "Or click here to see the top result.",
alignment="bottom", theme="arrows") '''[value="I'm Feeling Lucky"]''',
alignment="bottom", theme="arrows")
self.play_tour() self.play_tour()
``` ```

View File

@ -6,17 +6,12 @@ class MyTourClass(BaseCase):
def test_google_tour(self): def test_google_tour(self):
self.open('https://google.com') self.open('https://google.com')
self.wait_for_element('input[title="Search"]') self.wait_for_element('input[title="Search"]')
try:
# Remove the Privacy Checkup box if present.
self.assert_text('Privacy Checkup', '[role="dialog"]', timeout=2)
self.click('link=NO, THANKS')
except Exception:
pass # Google may have removed the Privacy Checkup. Continue.
self.create_tour(theme="dark") self.create_tour(theme="dark")
self.add_tour_step("Click to begin the Google Tour!", self.add_tour_step(
title="SeleniumBase Guided Tours") "Click to begin the Google Tour!", title="SeleniumBase Tours")
self.add_tour_step("Type in your search query here.", self.add_tour_step(
'input[title="Search"]') "Type in your search query here.", 'input[title="Search"]')
self.add_tour_step( self.add_tour_step(
"Then click here to search!", 'input[value="Google Search"]', "Then click here to search!", 'input[value="Google Search"]',
alignment="bottom", theme="arrows") alignment="bottom", theme="arrows")
@ -24,41 +19,49 @@ class MyTourClass(BaseCase):
"Or click here to see the top result.", "Or click here to see the top result.",
'''[value="I'm Feeling Lucky"]''', '''[value="I'm Feeling Lucky"]''',
alignment="bottom", theme="arrows") alignment="bottom", theme="arrows")
self.add_tour_step("Here's an example Google search...", self.add_tour_step("Here's an example Google search:", theme="arrows")
theme="arrows")
self.play_tour(interval=0) # If interval is 0, tour is fully manual self.play_tour(interval=0) # If interval is 0, tour is fully manual
self.highlight_update_text('input[title="Search"]', "GitHub") self.highlight_update_text('input[title="Search"]', "GitHub")
self.highlight_click('input[value="Google Search"]') self.highlight_click('input[value="Google Search"]')
self.create_tour(theme="dark") self.create_tour(theme="dark")
self.add_tour_step("Search results appear here!", self.add_tour_step(
title="(5-second autoplay on)") "Search results appear here!", title="(5-second autoplay on)")
self.add_tour_step("Let's take another tour...", self.add_tour_step(
title="Ready for more?", theme="square") "Let's take another tour...",
title="Ready for more?", theme="square")
self.play_tour(interval=5) # tour automatically continues after 3s self.play_tour(interval=5) # tour automatically continues after 3s
self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z") self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
self.wait_for_element('input#searchboxinput') self.wait_for_element('input#searchboxinput')
self.create_tour(theme="dark") self.create_tour(theme="dark")
self.add_tour_step("Welcome to Google Maps!") self.add_tour_step(
self.add_tour_step("Type in a location here.", "Welcome to Google Maps!")
"#searchboxinput", title="Search Box") self.add_tour_step(
self.add_tour_step("Then click here to show it on the map.", "Type in a location here.", "#searchboxinput", title="Search Box")
"#searchbox-searchbutton", alignment="bottom") self.add_tour_step(
self.add_tour_step("Or click here to get driving directions.", "Then click here to show it on the map.",
"#searchbox-directions", "#searchbox-searchbutton", alignment="bottom")
alignment="bottom", theme="square-dark") self.add_tour_step(
self.add_tour_step("Use this button to switch to Satellite view.", "Or click here to get driving directions.",
"div.widget-minimap", alignment="right") "#searchbox-directions", alignment="bottom", theme="square-dark")
self.add_tour_step("Click here to zoom in.", self.add_tour_step(
"#widget-zoom-in", alignment="left") "Use this button to switch to Satellite view.",
self.add_tour_step("Or click here to zoom out.", "div.widget-minimap", alignment="right")
"#widget-zoom-out", self.add_tour_step(
alignment="left", theme="default") "Click here to zoom in.", "#widget-zoom-in", alignment="left")
self.add_tour_step("Use the Menu button to see more options.", self.add_tour_step(
".searchbox-hamburger-container", alignment="right") "Or click here to zoom out.", "#widget-zoom-out",
self.add_tour_step("Or click here to see more Google apps.", alignment="left", theme="default")
'[title="Google apps"]', alignment="left") self.add_tour_step(
self.add_tour_step("Thanks for trying out SeleniumBase tours!", "Use the Menu button to see more options.",
title="End of Guided Tour", theme="square") ".searchbox-hamburger-container", alignment="right")
self.add_tour_step(
"Or click here to see more Google apps.", '[title="Google apps"]',
alignment="left")
self.add_tour_step(
"Thanks for trying out SeleniumBase Tours!",
title="End of Guided Tour", theme="square")
self.play_tour() # If interval isn't set, tour is fully manual self.play_tour() # If interval isn't set, tour is fully manual