- What is Python?
- How to Install Python?
- Python Variables and Operators
- Python Loops
- Python Functions
- Python Files
- Python Errors and Exceptions
- Python Packages
- Python Classes and Objects
- Python Strings
- PostgreSQL Data Types
- Python Generators and Decorators
- Python Dictionary
- Python Date and Time
- Python List and Tuples
- Python Multithreading and Synchronization
- Python Modules
- What is Python bytecode?
- Python Regular Expressions
- Selenium Basics
- Selenium with Python Introduction and Installation
- Navigating links using get method Selenium Python
- Locating Single Elements in Selenium Python
- Locating Multiple elements in Selenium Python
Interview Questions & Answers
Interview Questions of Python selenium
Q1) What is Selenium and what is composed of?
Selenium is a suite of automated web testing resources.
It is a recording and replay method. It is a Plugin for Firefox
WebDriver and RC:
It offers APIs for a number of languages, such as Java, .NET, PHP, etc. The Webdriver and RC browsers work for most of them.
Q2) Why my pip is not working when my python setup is not installed properly?
Executable path is not set correctly.
Q3) How Can we open Different browser using python?
For Firefox browser
driver=webdriver.Firefox(“Path of Firefox Driver”)
for IE browser
driver=webdriver.Ie(“Path of IE Driver”)
For Chrome browser
driver=Webdriver.Chrome(“Path of Chromedriver”)
Q4) What are the different types of annotations which are used in Selenium?
Following are the annotations are used in selenium:
Q5) What is the commands for downloading selenium?
pip install –U selenium
sudo pip install python
Q6) What are the different locators used?
- Class name
- Tag name
- Partial link text
- CSS Selector
- link text
Q7) What is a locator?
It is a web page element that the python script can communicate with via the selenium driver.
Q8) What is a Webdriver?
Selenium provides a tool for interacting with various browsers on the web. And they control the script’s operation.
Q9) How to find element by hyperlink?
Find_element_by_link_text(“text of that hyperlink”).click()
Q10) What is pass in python.
Pass means that there is no operation to do.
Q11) Can we use selenium when the webpage and resource locater elements are changing frequently?
Q12) What are the different Navigation oprations in selenium?
used to refresh
used to navigate back
used to move forward
Q13) What is the WebDriver used to run selenium script on chrome browser?
Q14) What is the use of automation testing?
This will reduce manpower and thus reduce the amount of time we spend on manual inspection at all times.
Q15) What is used to create unicode strings in Python language?
Add u before the string u ‘mystring’
Q16) Why you prefer to use Python for Selenium?
Python is one of the easy-to-use programming languages and is not very big or complex. Python APIs allow us, via Selenium, to connect to the browser. In terms of the differences in browser architecture, Selenium can express normal Python commands to different browsers.
Q17) Which is the slowest locator?
Q18) When webpage is dynamic which element locater do we use to locate an element?
Q19) What is the difference between quit() and close() function of the web browser?
This feature manages the entire browser for all open windows and guarantees that the processes are closed and terminated properly without any memory leaks.
The latest executing window will close and you can still turn to other window handles, even though the newly running window is locked.
Q20) Whats XPATH?
It is the direction finder of the expandable markup language where the data is stored in XML format such as Key value pair.
Q21) What is a Webdriver?
Selenium is a tool for interacting with multiple browsers on the internet. And they monitor the script’s operation.
Q22) Explain how to assert text of webpage using selenium 2.0?
WebElement el = driver.findElement(By.id(“ElementID”))
String text = el.getText();
Assert.assertEquals(“Element Text”, text);
Q23) What are the different types of drivers currently supported by Selenium Webdriver?
The supported drivers are:
- Gecko driver
Q24) Explain what is assertion in Selenium and what are the types of assertion?
As a verification stage, statement is used. It verifies that the state of the request is in line with what is planned. Assert prove and waitFor are the types of assertion.
Q25) What is the difference between verify and assert commands?
The Verify command tests if the object is on the page, and the test continues to run if it is not. In verification, even if every test fails, all the commands are expected to run.
Assert helps you to verify whether or not an element exists on the page. If the proclaimed aspect is not available, the evaluation would end at the phase failed. In other words, at the point where the search fails, the evaluation will be terminated.