Selenium – Open Safari browser

Python Selenium – Open Safari

In this tutorial, you shall learn how to open Safari browser, using Selenium, in Python language.

Prerequisites

We have to set the Allow Remote Automation to open Safari browser using Selenium.

To set Allow Remote Automation in Safari browser,

Steps to open Safari browser using Selenium Python

Step 1

Import webdriver module from selenium module.

from selenium import webdriver

Step 2

Create a Safari driver instance using webdriver.Safari() class.

driver = webdriver.Safari()

Example

In the following example, we followed the above said steps to create a Safari driver instance, and open a Safari browser window.

Python Program

from selenium import webdriver

# Setup Safari driver
driver = webdriver.Safari()

# Navigate to the url
driver.get('https://pythonexamples.org/tmp/selenium/index.html')

# Close the driver
driver.quit()

Screenshot

Summary

In this Python Selenium Tutorial, we have seen how to create a Safari driver instance and open a Safari browser window.

Related Tutorials

Privacy Policy Terms of Use

SitemapContact Us