2. Here the steps
• The installation and setup of Selenium webdriver in Python
can be done with the steps listed below −
• Step 1 Navigate to the site having the below link
− −
• https://www.python.org/downloads/
• Step 2 Click on the Download Python <version number>
−
button.
4. Step 3 The executable file for Python should get
−
downloaded in our system. On clicking it, the Python
installation page should get launched.
5. • Step 4 Python should be downloaded in the following
−
path:
• C:Users<User>AppDataLocalProgramsPython
Python<version>
• Step 5 For the Windows users, we have to configure the
−
path of the Python and the Scripts folder (created inside the
Python folder) in the Environment variables.
6. Step 6 To check if Python has successfully installed, execute the
−
command − py --version. The Python version should get displayed.
Step 7 For the Selenium bindings installation, run the command
−
mentioned below − py –m pip install selenium.
Step 8 A new folder called the Selenium should now be generated
−
within the Python folder (look inside the Lib folder). To upgrade to the
latest Selenium version, run the command given below −
Py –m pip install selenium.
Step 9 To verify if Selenium has been installed properly, execute the
−
command mentioned below −
Py –m pip show Selenium.
Step 10 Next, we have to download the Python editor called PyCharm
−
from the below link −
https://www.jetbrains.com/pycharm/
Step 11 Click on Download.
−
7. Step 12 For Selenium webdriver in Python, click on the Download button which is below
−
the Community version (free for use).
9. Step 13 After installation of PyCharm, we have to create a new
−
project from File -> New Project -> Give a project name, say
pythonProjectTest. Then, click on Create.
Step 14 We have to create a Python package by right-clicking on the
−
new project we created in Step13, click on New then select Python
Package. Give a package name, say SeleniumTest and proceed.
10. Step 15 We have to create a Python file by right-clicking on the new package we created in Step 14,
−
click on New then select Python File. Give a package name, say test1.py and proceed.
11. Step 16 To view the Selenium packages in our
−
project, click on External Libraries and then expand
the site-packages folder.
12. How to Install PIP on Windows ?
Python is a widely-used general-purpose, high-level programming
language. Python is a programming language that lets you work quickly
and integrate systems more efficiently.
PIP is a package management system used to install and manage
software packages/libraries written in Python. These files are stored in a
large “online repository” termed as Python Package Index (PyPI). pip
uses PyPI as the default source for packages and their dependencies.
So, whenever you type:
pip install package_name
pip will look for that package on PyPI and if found, it will download and
install the package on your local system.
13. Check if Python is installed
Run the following command to test if python is installed or not. If not
click here.
python --version
Download and Install pip
The PIP can be downloaded and installed using the command line by going through
the following steps:
Method 1: Using cURL in Python
Curl is a UNIX command that is used to send the PUT, GET, and POST requests to a
URL. This tool is utilized for downloading files, testing REST APIs, etc.
Step 1: Open the cmd terminal
Step 2: In python, a curl is a tool for transferring data requests to and from a server.
Use the following command to request:
15. Let’s talk about Selenium
Selenium is an open-source automated
testing suite used by developers for creating
web applications across multiple browsers
and platforms.
Selenium focuses on automating web-based
applications.
Developers are like to perform testing with
16. There are four key components of it:
Selenium IDE
WebDriver
Selenium Remote Control
Selenium Grid
17. Web Element in Selenium
Anything available on the webpage is a
Web Element, such as a button, scroller,
text box, etc.
Selenium WebDriver represents a DOM
element, and we create all the documents
Web
Element for
an HTML
element
18. There are several techniques with which
the WebDriver can detect the Web
Element, which are dependent on unique
properties, like ID, Name, XPath, Class,
CSS Selectors, Tagname, link Test, etc.
19. Two main methods offered by WebDriver to find the webpage elements a
FineElement() FindElements()
20. Types of Web Elements:
Edit Box - This is a basic text control that allows us to enter a small
amount of text.
Button – It is a clickable button that we can use in
different forms and places in the document that
requires a standard, easy-to-use button functionality.
Link – A link is known as a hyperlink that connects
one web page to another. Users can click on that link
to navigate from page to page.
21. Types of Web Elements:
Image, image button, and image link - It helps to perform
various actions on images like clicking on the image button or
image link.
Text Area - We use this
element to enter a plain text
editing control that includes
multiple lines.
Checkbox - The checkbox is a selection box or
a tick box element made of a small interactive
box that we can mark to indicate 'yes' or 'no'.
Radio button – We use it as an option
button that is a graphical control
element. The radio button allows the
user to select only a single predefined
set of mutually unique options.
Dropdown list – A Dropdown
list is a graphical control
element that allows the user to
select a single value from the
list. When it is inactive, it
displays only a single value.
22. What operations are performed on the WebElement?
To access WebElement, developers need to complete a set of
operations, starting with browser actions until the operations
run on frames.
23. Browser operations
1. Launch the browser
2. Navigate to specific web page
3. Close the current browser
4. Close every browser opened by WebDriver at the
time of execution
5. Maximize browser
6. Refresh the browser
28. Image Operations
o General image with no functionality
o Clickable image button
o Redirecting image link
29. Text area operations
Return or capture the messages received from the web
page
Checkbox operations
Tick the checkbox
Undo the checkbox
Radio button operations
Choose radio button
Determine if it shows the radio button
30. Drop down operations
Choose an item from the list
Get the item count
Frame operations
Switch from top window to specific web page frame
Switch to frame to top window
31. Given below is the list of different elements that can
be helpful in Selenium automation testing.
SPEED CONTROLLER : While talking about the Selenium IDE, the speed
controller is used to control the speed of showing that how fast a test case runs.
You can run tests cases and then slow them down to run the test cases.
RUN ALL BUTTON: We use this to run the entire suite. In many cases, when
you run the test cases for your software applications, you only need to open the
test suite and then press the hit button. In many cases, it will run the 5 test
cases one by one.
RUN BUTTON: We use this to run the selected test case.
32. Given below is the list of different elements that can
be helpful in Selenium automation testing.
PAUSE/ RESUME BUTTON: We use the pause button to pause the running test
cases, and we use the resume button to restart the pausing process.
STEP BUTTON: We use this to run the test commands manually by using the test
run commands all one by one. In that case, you need to pause your test cases and
then run the commands all one by one with the help of a step button. We generally
use it to debug the script in the Selenium IDE.
RECORD/STOP BUTTON: We use this to record the user's navigation browser that
would help in navigating the web browsers at a relatively easy pace. We use this
button to stop the working of any specified function.