How to Install and Set Up Selenium WebDriver With Python (Part 1)

128.5K views
•
July 3, 2020
by
Naveen AutomationLabs
YouTube video player
How to Install and Set Up Selenium WebDriver With Python (Part 1)

TL;DR

Set up Selenium WebDriver with Python by installing Python 3.x, adding the Python and Scripts folders to the Windows Path, creating a PyCharm project with a virtual environment, and running "pip install -U selenium." The lesson demonstrates Python 3.8.3 and also identifies ChromeDriver and Mozilla geckodriver as required browser executables. Read on for the exact installation sequence, prerequisites, and project settings.

Transcript

this conference will now be recorded okay this is Naveen event compaction every not a mission lapse but as particular video the good news is that we are going to start our new Python series with selenium so far in my my channel view guys have seen that selenium with Java most of the time we have used web driver I of a JavaScript we have used Cypres... Read More

Key Insights

  • Python 3.x is the required starting point for the Selenium setup, and the installed version can be checked by running the Python version command in a command prompt. The transcript demonstrates Python 3.8.3 and advises users with Python 2 to install a current Python 3.x release.
  • The Windows Path configuration requires two Python locations: the main Python installation folder and its Scripts folder. After adding both entries through Environment Variables, the command prompt should be closed and reopened before running the version command to confirm that Python is available.
  • Basic Python knowledge is sufficient for beginning Selenium automation, including functions, constructors, variables, for loops, if-else conditions, tuples, dictionaries, and lists. Learners who already understand Selenium with Java or JavaScript mainly need to become comfortable with Python syntax.
  • The Python console can execute simple statements directly, such as assigning a value to a variable or calculating an addition. However, the console is described as less user-friendly for Selenium development because an editor provides method suggestions and a more convenient way to write and execute code.
  • PyCharm Community is a free editor recommended for the Selenium Python project. The transcript also identifies WebStorm, Eclipse, and Visual Studio Code as possible alternatives, while advising learners to choose the editor that fits their preferences.
  • A PyCharm Selenium project should use a virtual environment by default and select the installed Python executable as its interpreter. The project setup associates Python 3.8 with the workspace and places additional libraries under the environment's site-packages area.
  • Pip is the package installer used to add Selenium libraries to a Python project. The supplied installation command is "pip install -U selenium," and pip is compared with Maven dependency management for Java and npm package management for JavaScript.
  • The planned Selenium Python series extends beyond installation to locators, dropdowns, actions, scrolling, clicks, pop-ups, implicit waits, explicit waits, unit tests, pytest, the Page Object Model, reports, Jenkins, and GitHub integration. The opening sessions are intended to establish comfort with the Python syntax for core Selenium features.

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: How do I set up Selenium WebDriver with Python?

Install Python 3.x, then add both the main Python installation folder and its Scripts folder to the Windows Path. Create a PyCharm project with a virtual environment and the installed Python executable, run "pip install -U selenium," and obtain the appropriate ChromeDriver or Mozilla geckodriver executable.

Q: How do I install Python for Selenium WebDriver?

Download a Python 3.x installer from python.org and run the installer for your operating system. The lesson demonstrates Python 3.8.3 on Windows and advises anyone using Python 2 to install Python 3.x.

Q: How do I verify that Python is installed on Windows?

Open a command prompt and run the Python version command demonstrated in the lesson. A successful setup displays the installed version, shown here as Python 3.8.3; after changing Path, close the command prompt and reopen it before checking.

Q: Which Python topics should I know before using Selenium?

You should understand functions, constructors, variables, for loops, if-else conditions, tuples, dictionaries, and lists. If you already know Selenium with Java or JavaScript, the main adjustment described is becoming familiar with Python syntax.

Q: Which IDE should I use for Selenium with Python?

The lesson recommends the free PyCharm Community edition for writing and running Selenium Python code. WebStorm, Eclipse, and Visual Studio Code are also mentioned as alternatives, so you can choose the editor you prefer.

Q: How do I create a Selenium Python project in PyCharm?

In PyCharm, choose File and then New Project, provide the project name and location, and keep the virtual environment option. Select the installed Python executable as the base interpreter, then create the project so its additional libraries can be managed under site-packages.

Q: How do I install the Selenium package for Python?

Use pip after creating the project and its virtual environment. Run "pip install -U selenium" to add Selenium to the project; the lesson compares pip with Maven dependency management for Java and npm package management for JavaScript.

Q: Which browser drivers are needed for Selenium Python?

Chrome requires the ChromeDriver executable, while Firefox requires Mozilla geckodriver. The lesson directs users to the respective download pages because these executables are part of launching a browser through Selenium WebDriver.

Summary & Key Takeaways

  • The setup begins with Python 3.x and a basic understanding of Python functions, constructors, variables, loops, conditional statements, tuples, dictionaries, and lists. On Windows, the Python installation directory and its Scripts directory must be added to the Path environment variable before confirming the installation from a newly opened command prompt.

  • PyCharm Community is presented as the preferred free editor, although WebStorm, Eclipse, and Visual Studio Code are also mentioned as alternatives. A new Selenium Python project should use a virtual environment and the installed Python executable as its interpreter, allowing project libraries to be managed under the environment's site-packages directory.

  • Selenium is added to the Python project through pip, which serves a role comparable to package management with Maven for Java or npm for JavaScript. The command provided is "pip install -U selenium." Browser automation also requires driver executables, with ChromeDriver and Mozilla geckodriver download pages supplied in the description.


Read in Other Languages (beta)

Share This Summary 📚

Explore More Summaries from Naveen AutomationLabs 📚