Test Safari navigation to Google.
(driver: 'WebDriver')
| 61 | |
| 62 | |
| 63 | def test_navigation(driver: 'WebDriver') -> None: |
| 64 | """Test Safari navigation to Google.""" |
| 65 | contexts = driver.contexts |
| 66 | for context in contexts: |
| 67 | if context.startswith('WEBVIEW_'): |
| 68 | driver.switch_to.context(context) |
| 69 | break |
| 70 | else: |
| 71 | pytest.fail('Could not set WEBVIEW context') |
| 72 | |
| 73 | driver.get('http://google.com') |
| 74 | for _ in range(5): |
| 75 | time.sleep(0.5) |
| 76 | if 'Google' == driver.title: |
| 77 | return |
| 78 | |
| 79 | pytest.fail('The title was wrong') |