We Offer 100% Job Guarantee Courses (Any Degree / Diploma Candidates / Year GAP / Non-IT / Any Passed Outs). Placement Records
Hire Talent (HR):+91-9707 240 250

Interview Questions

Selenium with Python Interview Questions and Answers

Selenium with Python Interview Questions and Answers

Selenium with Python Interview Questions and answers for beginners and experts. List of frequently asked Selenium with Python Interview Questions with answers by Besant Technologies. We hope this Selenium with Python Interview Questions and answers are useful and will help you to get the best job in the networking industry. This Selenium with Python Interview Questions and answers are prepared by Selenium with Python Professionals based on MNC Companies expectation. Stay tuned we will update New Selenium with Python Interview questions with Answers Frequently. If you want to learn Practical Selenium with Python Training then please go through this  Selenium with Python training in Bangalore

Best Selenium with Python Interview Questions and Answers

Besant Technologies supports the students by providing Selenium with Python Interview Questions and Answers for the job placements and job purposes. Selenium with Python is the leading important course in the present situation because more job openings and the high salary pay for this Selenium with Python and more related jobs. We provide the Selenium with Python online training also for all students around the world through the GangBoard medium. These are top Selenium with Python Interview Questions and answers, prepared by our institute experienced trainers. we do Offers best Selenium Courses in Chennai City for Clearing your Interviews.

Selenium with Python Interview Questions and Answers for the Job Placements

Here is the list of most frequently asked Selenium with Python Interview Questions and answers in technical interviews. These questions and answers are suitable for both freshers and experienced professionals at any level. The questions are for intermediate to somewhat advanced Selenium with Python professionals, but even if you are just a beginner or fresher you should be able to understand the answers and explanations here we give. Enroll for Best Selenium with Python Online Course

Q1) What is Selenium WebDriver

Selenium Web driver is set of class which used automate the web application.

Q2) Is Selenium Web Driver Automation Tool?

No Selenium web Driver is not an Automation tool, its a framework or set of class which is used to automate a web based application.

Q3) What kind of application best suited for Selenium and why it should be selected.

It is used to automate web based application and have browser and Platform compatibility. It supports multiple language such as java, C# and Python.

Q4) Can Selenium Web Services tested using Selenium?

No it is used to automate only web based application.

Q5) What is different locator supported in selenium.

Different Locators are:
* ID
* ClassName
* Name
* TagName
* LinkText
* Partial Link Text
* XPATH
* CSS

Q6) How Can we launch Different browser using python.

For Chrome
driver=Webdriver.Chrome(“PathofChromedriver”)
For Firefox
driver=webdriver.Firefox(“Path of Firefox Driver”)
for IE
driver=webdriver.Ie(“Path of IE Driver”)

Q7) How Synchronization works in Selenium.

Synchronization is achieved using Implicit Wait and Explicit Wait.

Q8) What is Implicit Wait.

Implicit Wait is used to default waiting time.

Q9) What is explicity Wait.

Explicit Wait is used to halt the execution untill condition is met or when time is elasped.

Q10) How can enter the values in text box using python.

driver.find_element(By.ID,”Value”).send_keys(“Value”)

Q11) How can we check if control enabled or not?

driver.find_element(By.ID,”Value”).is_enabled(), this specific method will return if true or false.

Q12) How can we get text of a web element.

driver.find_element(By.ID,”Value”).text, this specific method will return innertext of the control.

Q13) Is there any other way of retrieving text of web element.

driver.find_element(By.ID,”Value”).get_attribute(“InnerText”)

Q14) What are the different ways of selecting the values in dropdown.

* SelectByValue: select the option based on option value.
* selectByVisibleText: selects the option based on visible text.
* selectByIndex: selects the option base on Index

Q15) what are the different Navigation command in selenium

it is used to refresh
driver.refresh()
it is used to navigate back
driver.back()
it is used to move forward
driver.forward()

Q16) What is the difference b/w findelement and findelements

FindElement returns first matching element.
FindElements returns more than one elements.

Q17) what is the difference b/w Driver.Close and Diver.quit

close is used to close the entire browser
quit is used to close the working tab.

Q18) Can selenium handle the windows pop up?

No Selenium can’t handle windows pop Up

Q19) Can selenium handle WebBased Pop Up.

Yes it can handle web based pop up using “driver.switch_to_alert()”

Q20) How can capture screenshot in selenium.

driver.get_screenshot_as_file(“filename”) with this method we can take screen shot.

Q21) What are switch Class in selenium.

Switch class are used to switch between the different browser,frames and alert pop up.

Q22) What Action class in selenium

Action class is user facing API to achieve complex user action events.

Q23) How can we perform drag drop in selenium

act=ActionChains(driver)

act.drag_and_drop(sourcelement,targetelement), with this method we can perform drag and drop

Q24) How can mouse hover on a control in selenium.

act=ActionChains(driver)
act.move_to_element(element)
with the above method we mouse hover on element, element argument is web element where we need to mouse hover.

Q25) Can we move the mouse control to specific cooridinate in selenium

yes we can, selenium provides Action class in which we can make use of the act.move_by_offset() method to move the mouse control to specific coordinates.

Q26) Write a method to read data from webtable for specific row and column index using selenium.

def GetData(rowIndex,colIndex):
tablerows=driver.find_element_by_id(“IdValue”).find_elements_by_tag_name(“tr”)
tableDefinitons=tablerows[rowIndex+1].find_elements_by_tag_name(“td”)
return tableDefinitons[colIndex].get_attribute(“innerText”)

Q27) What are Python unitTest default methods

#Will execute before the execution of each test method
def setUp(self):
pass

# will execute once before it executes any test methods
def setUpClass(cls):
pass
#will execute after the execution of each test method
def tearDown(self):
pass
# will execute after it executes all the test methods.
def tearDownClass(cls):
pass

Q28) Can Image or Captcha be automated using selenium

No captcha or image can’t be automated.

Q29) How will install selenium in python

We will use PIP command to install selenium
Pip install selenium Version_Nos

Q30) What is difference between list and tuple.

list is mutuable while tuple is not mutuable.

Q31) What is pass in python.

pass means no operation to be done

Q32) How can we convert string to int in python.

using int(“23″) to convert to int.
str(23) to convert to string

Q33) How will you handle exception in python

try,except and finally key word is used to handle the exception

try:
#code
except: #catches the exception
finally: #executes the block whether any exception is raised or not.

Q34) What are the different data types supported in python

integer,string,float and complex are the supported data types in python

Q35) What is MRO in python

Method Resolution order is used in inheritance concepts
where class is inheriting multiple class and in all the parent class, same method is defined. Child class is confused which method to call during run time. So the MRO helps to resolve the issue.

Q36) How will identify when web element doesn’t have any of the unique locater.

we can make use of the get_attribute method to get web element from list of web elements.

for control in controls:
if control.get_attribute(“attributename”)==”attributeValue”:
#found the matching control

Q37) What is differnce b/w link text and partial link text.

LinkText will return element which exact match of given text.
partial link text will return which include the given text.

Q38) How to execute java script in selnium with pyton

driver.execute_script(script)
above method will execute the java script.

Q39) What are the differnt way entering value TextBox

* driver.find_element_by_id(“val”).send_keys(“valuetoebeentered”)

* other is using Action Class
act=ActionChains(driver)
act.send_keys_to_element(control,”Valuetobeenterd”)

Q40) What is the use of Xpath

xpath is used to find the web element in webpage.

Q41) What is the difference between single and double slash in xpath

single slash is start selection from the document node.
double slash is start selection from anywhere in the document.

Q42) What are the different exception in selenium

* webdriver exception
* noalertPresent Exception
* nosuchwindow Exception
*nosuchelement exception
*timeoutexception

Q43) How will perform double click on web element

act=ActionChains(driver)
act.double_click(control)
Above method will be used to double click on the control.

Q44) What is difference between getwindowHandle() and getwindowHandles()

getWindowHAndle()- it is used to get address of the the current browser where the control is and return type is string.

getwindowshandles()- it is used to get the address of the all open browser and its return type is set<string>

Q45) How will you handle multiple windows in selenium

we can use “switch_to_window” method to switch between the multiple windows. where in argument we would be sending the address of the window in the form of string.

Q46) How will you verify if you have switched between the correct window.

we can verify the window title to see if the we have switched to correct window or not.

driver.switch_to_window(“windowname”)
if driver.title==”ttileNAme”:
#switched to correct window

Q47) What is framework?

Framework defines a set of rules or best practices which we can follow in systematic way to achieve the desired results.

Q48) What are the different automation Frameworks

* Data Driven Framework
* Key Driven Framework
* Hybrid Framework

Q49) How to login into any site if it showing autentication pop up for username and password

To achieve this type of issue we can pass username and pwd with URL
http://username:password@url

Q50) How to fetch the current URL in selenium

driver.current_url returns the current url of the browser

Q51) How do you convert a number into a string?

>use str() inbuilt function in python

Q52) What is slicing?

> Slicing is used to fetch a specific range of items from sequence types like list, tuple, Strings etc

Q53) what is the o/p of teh following code?

i = 6
while (i==6):
print(“Value of i is”+i)
> ‘value of 1 is 6’ and program will not stop

Q54) what is the o/p of len(”)

> 0

Q55) write a program for the below pattern with only one while loop

*
**
***
****
*****
****
***
**
*
> a = 0
bool = True
While(a<=5):
if(a<0): break; if(a==5): bool = False if(bool): a = a + 1 else: a = a – 1 print(“*”*a)

Q56) Does python support Multiple inheritence” open=”no” style=”default” icon=”plus” anchor=”” class=””]

> Yes

Q57) Which of the following functions does return a list of elements

1. find_element_by_xpath
2. find_element_by_id
3. find_elements_by_name
4. find_element_by_partial_link_text
5. find_element_by_link_text
>3

Q58)which of the following is not a valid webdriver class

1. webdriver.ActionChains
2. webdriver.Firefox
3. webdriver.HtmlUnit
4. webdriver.Chrome
> 1

Q59)How to find the length of the list? ?

Len(list)

Q60) write a program for the below pattern 1 12 123 1234 12345 > a = 0

While(a<5):
val = 0
while(val<=a): val = val +1 strprint = str(a) print(str(val), end = “”) a = a + 1 print()

Q61) Explain implicit wait?

In implicit wait we define specific amount of wait time in the beginning of the test .So it direct the web driver to wait till that time before throwing an exception.

Q62) Different types of locator in webdriver?

Xpath,css,id classname,linktext,name

Q63) Explain different types of navigation commands in selenium?
  • navigate().back()

This command requires no parameter from the user and it lets the user to take back the user to the previous webpage with the reference to the browsing history

  • navigate().forward()

This command helps the user to nagigate to the next webpage depending on the browsing history

  • navigate().refresh()

This command will help to refresh the currently using webpage ,hence it will reload all the web  elements.

  • navigate().to()

This command helps to launch a new window and let the user to navigate to the required URL

Q64) Explain Object repository?

Rather than scattering the objects in the script ,it helps to store all the object in centralized location .

Q65) Different exceptions in Selenium webdriver?
  • Timeout Exception
  • NoAlertPresentException
  • NoSuchWindowException
  • NoSuchElementException
  • WebDriverException
Q66) Explain the limitations of Selenium IDE
  • Reading from external files will not be possible
  • Conditional statement execution will not be possible
  • Exception handling will not be possible
  • Ide uses only HTML language
  • Reading from external database is not possible
Q67) What is ‘suit’ in python?

Making a logical block using a group of individual statement

Q68) Explain range() in python

range()  helps to iterate over a sequence of number.

Q69) What is Slicing in Python.

It is  a string operation  to extract a part of string  or the list

Q70) Explain Generators in Python

Functions which returns an iteratable set of items are called generators.

Q71) What are Python packages

The namespace that contain multiple modules called python package

Q72) Explain Encapsulation in python

Wrapping the data and code together in a single unit called Encapsulation

Q73) Which are the Open-source Frameworks supported by Selenium WebDriver?
  • JUnit
  • TestNG
Q74) Explain how to fetch the current page URL in Selenium?

By using getCurrentURL()

Q75) Explain how to delete cookies?

To delete cookies , use the command deleteAllCookies()

Q76) What are unittests in Python?

To perform unit testing Framework ‘unittest’ is using.

Q77) What is tuple in Python

Tuple is an immutable built-in datatype used to store value in a sequence.

Q78) Is python an interpreted language?

Yes ,Python language run directly from the source code.

Q79) What are the four elements that you have to pass in selenium?

The main four parameter that we should passed in selenium are

  • URL
  • Browser
  • Port Number
  • Host
Q80) Difference between getwindowhandles() and getwindowhandle()?

We use getwindowhandles() especially to getting all the address of whatever browser we opened and it return all the data in string

And getwindowhandle() is used to get the address of current browser where the control is and also return the data in string

Q81) If you want to insert a breakpoint in IDE ,how will you do this?
  • First we need to select “toggle breakpoint “by right clicking the command in the Selenium IDE
  • Then, press B on the keyboard and select the command
Q82) Explain selenium Grid?

Distributed tests across multiple machine

Q83) What is Python zip()

It is used to transform multiple lists into single list by taking the corresponding elements of lists that are passed as parameter.

Q84) Explain Web scraping?

The method of extraction of large amount of data from website and store it to the local machine

Q85) What will be used to Make Unicode string in python?

We need to use ‘Unicode’ before the string

Eg:Unicode(data)

Besant Technologies WhatsApp