Interview Questions

Selenium with Python Interview Questions and Answers

Interview Questions December 31, 2018
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.

Selenium with Python Interview Questions and answers for the job placements

Here is the list of most frequently asked Selenium with PythonInterview 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.

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 compatiblity. It supports mulitple 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

Q6) How Can we launch Different browser using python.

For Chrome
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 Implict 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.


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 reteriving text of web element.


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
it is used to navigate back
it is used to move 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 webbased 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.drag_and_drop(sourcelement,targetelement), with this method we can perform drag and drop

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

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 cooridinates.

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

def GetData(rowIndex,colIndex):
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):

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

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

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

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

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

Q43) How will perform double click on web element

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.

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

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
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

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? ?


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

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

Besant Technologies – Chennai & Bangalore Branch Locations

Besant Technologies - Velachery Branch

Plot No. 119, No.8, 11th Main road, Vijaya nagar,

Velachery, Chennai - 600 042

Tamil Nadu, India

Landmark - Reliance Digital Opposite Street

  +91-8099 770 770

Besant Technologies - Tambaram Branch

No.2A, 1st Floor, Duraisami Reddy Street,

West Tambaram, Chennai - 600 045

Tamil Nadu, India

Landmark - Near By Passport Seva

  +91-8099 770 770

Besant Technologies - OMR Branch

No. 5/318, 2nd Floor, Sri Sowdeswari Nagar,

OMR, Okkiyam Thoraipakkam, Chennai - 600 097

Tamil Nadu, India

Landmark - Behind Okkiyampet Bus Stop,

  +91-8099 770 770

Besant Technologies - Porur Branch

No. 180/84, 1st Floor, Karnataka Bank Building,

Trunk Road, Porur, Chennai - 600 116

Tamil Nadu, India

Landmark - Opposite to Gopalakrishna Theatre

  +91-8099 770 770

Besant Technologies - Anna Nagar Branch

Plot No:1371, 28th street kambar colony,

I Block, Anna Nagar, Chennai - 600 040

Tamil Nadu, India

Landmark - Behind Reliance Fresh

  +91-8099 770 770

Besant Technologies - T.Nagar Branch

Old No:146/2- New No: 48,

Habibullah Road,T.Nagar, Chennai - 600 017

Tamil Nadu, India

Landmark - Opposite to SGS Sabha

  +91-8099 770 770

Besant Technologies - Thiruvanmiyur Branch

22/67, 1st Floor, North mada street, Kamaraj Nagar

Thiruvanmiyur, Chennai 600041

Tamil Nadu, India

Landmark - Above Thiruvanmiyur ICICI Bank

  +91-8099 770 770

Besant Technologies - Siruseri Branch

No. 4/76, Ambedkar Street, OMR Road, Egatoor, Navallur,

Siruseri, Chennai 600130

Tamil Nadu, India

Landmark - Near Navallur Toll Gate, Next to Yamaha Showroom

  +91-8099 770 770

Besant Technologies - Maraimalai Nagar Branch

No.37, Ground Floor, Thiruvalluvar Salai,

Maraimalai Nagar,Chennai 603209

Tamil Nadu, India

Landmark - Near to Maraimalai Nagar Arch

  +91-8099 770 770

Besant Technologies - BTM Layout Branch

No 2, Ground floor, 29th Main Road,

Kuvempu Nagar,BTM Layout 2nd Coming from Silkboard,

AXA company signal, Stage, Bangalore - 560 076

Karnataka, India

Landmark - Next to OI Play School

  +91-8767 260 270

Besant Technologies - Marathahalli Branch

No. 43/2, 2nd Floor, VMR Arcade,

Varthur Main Road, Silver Springs Layout,

Munnekollal, Marathahalli, Bengaluru - 560037

Karnataka, India

Landmark - Near Kundalahalli Gate Signal

  +91-8767 260 270

Besant Technologies - Rajaji Nagar Branch

No. 309/43, JRS Ecstasy, First Floor,

59th Cross, 3rd Block, Bashyam Circle,

Rajaji Nagar, Bangalore - 560 010

Karnataka, India

Landmark - Near Bashyam Circle

  +91-8767 260 270

Besant Technologies - Jaya Nagar Branch

No. 2nd Floor,1575,11th Main Road,

4th T-Block, Pattabhirama Nagar,

Jaya Nagar, Bangalore - 560 041

Karnataka, India

Landmark - Opposite to Shanthi Nursing Home

  +91-8767 260 270

Besant Technologies - Kalyan Nagar Branch

No.513, 4th Cross Rd

2nd Block, HRBR Layout,

Kalyan Nagar, Bangalore - 560 043

Karnataka, India

Landmark - Opposite to kalayan nagar Axis Bank

  +91-8767 260 270

Besant Technologies - Electronic City Branch

No. 7, 3rd Floor, Ganga Enclave,

Neeladri Road, Karuna Nagar, Doddathoguru Village,

Electronics City Phase 1, Electronic City,

Bangalore - 560100, karnataka, India

Landmark - Adjacent to HDFC Bank and State Bank Of India

  +91-8767 260 270

Besant Technologies - Indira Nagar Branch

No.54, 1st Floor,

5th Main kodihalli,

Bengaluru, Karnataka 560008, India

Landmark - Behind Leela Palace Hotel,

  +91-8767 260 270

Besant Technologies - HSR Layout Branch

Plot No. 2799 & 2800, 27th Main,

1st Sector, HSR Layout,

Bengaluru, Karnataka 560102, India

  +91-8767 260 270

Besant Technologies - Hebbal Branch

No.29, 2nd Floor, SN Complex,

14th Main Road, E-Block Extention, Sahakara Nagar,

Bengaluru, Karnataka -560092, India

  +91-8767 260 270

Scroll Up