If you are preparing for Selenium-Python Interview then also check below Q&A:
Python Interview Question & Answers Set - 01
Python Interview Q&A Set - 02
Introduction
Python supports the Object-Oriented Programming approach to establish the applications. It is simple and easy to learn and provides lots of high-level data structures. It is an open-source language.
Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. Through Selenium Python API you can access all functionalities of Selenium WebDriver in an intuitive way.
Selenium Python bindings provide a convenient API to access Selenium WebDrivers like Firefox, Ie, Chrome, Remote etc. The current supported Python versions are 3.5 and above.
If you are new to PYTHON then first check the post on How to Install Python on windows and mac?, once installation is complete then only checkout the below Q&A
How to Configure Selenium using Python
There are following steps to configure Selenium using Python:
- Download and install Python
- Install Selenium libraries in Python: use "pip install selenium" command
- Download and install PyCharm
- Create a new project and write the Selenium test script
- Run and validate the test scripts.
Let's start going through the Q&A:
How to start the session ?
driver = webdriver.Chrome(service=ChromeService(executable_path
=ChromeDriverManager().install()))
How to write the first Python Selenium script with Basic Commands?
Ans: Click the link HERE for the entire code
How to use ChromeDriver ?
Download the latest chromedriver from the download page. Unzip the file:
You should see an chromedriver
executable. Now you can create an instance of Chrome WebDriver like this:
The rest of the examples should work as given in the other documentation.
Does Selenium 2 support XPath 2.0 ?
Ref: http://seleniumhq.org/docs/03_webdriver.html#how-xpath-works-in-webdriver
Selenium delegates XPath queries down to the browser’s own XPath engine, so Selenium support XPath supports whatever the browser supports. In browsers which don’t have native XPath engines (IE 6,7,8), Selenium supports XPath 1.0 only.
How do I scroll down to the bottom of a page ?
You can use the execute_script method to execute javascript on the loaded page. You can call the JavaScript API to scroll to the bottom or any other position of a page.
Here is an example to scroll to the bottom of a page:
The window object in DOM has a scrollTo method is to scroll to any position of an open window. scrollHeight is a common property for all elements. document.body.scrollHeight will give the height of the entire body of the page.
How to auto save files using a custom Firefox profile?
The first step is to identify the type of file you want to auto save.
Lets understand the process with demo code and detailed steps check the Post HERE
How to upload files into file inputs ?
Ans: Select the <input type="file">
element and call the send_keys()
method passing the file path, either the path relative to the test script, or an absolute path. Keep in mind the differences in path names between Windows and Unix systems.
How to use firebug with Firefox ?
First download the Firebug XPI file, later you call the add_extension
method available for the firefox profile:
Using Selenium with remote WebDriver
Ans: Click HERE to understand the steps with the demo code
How to use Implicit wait in Selenium with python?
An implicit wait tells WebDriver to poll the DOM for a certain amount of time when trying to find any element (or elements) not immediately available. The default setting is 0 (zero). Once set, an implicit wait is set for the life of the WebDriver object.
How do I perform click and hold with Selenium-Python?
How to take screenshot of the current window ?
Use the save_screenshot method provided by the webdriver:
Click the link HERE with all the steps and demo code
****************************************
TOP 15 BDD - CUCUMBER Interview Q&A
************************************************
✍️AUTHOR: LinkedIn Profile
************************************************
Learn (API-Microservice)Testing+ Selenium UI Automation-SDET with Self Paced Videos prepared by FAANG employees and LIVE Doubt Session
*************************************************
SeleniumWebdriver Automation Testing Interview Questions:
https://automationreinvented.blogspot.com/search/label/SeleniumWebdriver
API Testing Interview Question Set:
https://automationreinvented.blogspot.com/2022/03/top-80-api-testing-interview-questions.html
DevOps Interview Q&A:
https://automationreinvented.blogspot.com/2021/11/top-11-devops-interview-questions-and.html
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes
Docker Interview Question Set
https://automationreinvented.blogspot.com/Docker
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign
Java Related Interview Question Set
https://automationreinvented.blogspot.com/search/label/Java
GIT Interview Question Set:
https://automationreinvented.blogspot.com/2021/09/top-40-git-interview-questions-and.html
Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions
Mobile Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Mobile%20Testing
Python Interview Question Set for QAE - SDET - SDE:
https://automationreinvented.blogspot.com/search/label/Python
No comments:
Post a Comment