Interview Questions of Python selenium – II

Q26) What is same origin policy? How you can avoid same origin policy?
Ans:-

For security purposes, the “Same Origin Policy” is enforced which assures that your site’s content is never available from another site via a script. As per the regulation, only within the domain of that website will any code loaded within the browser run.

Q27) What are the limitations of Selenium?
Ans:

Selenium’s major limitations are:

In online apps, you can only run experiments, not for desktop or handheld computers. (But there are other tools used to simplify GUI checks of desktop applications.)

With Selenium, captcha and barcode reading will not be automated. For them, manual testing is required.

The person who is going to run the Selenium Python automated tests must have prior knowledge of Python.

Q28) Explain different types of navigation commands in selenium?
Ans:

This order would help update the website that is actually in use, so all web components will be reloaded.

navigate().back()

This command does not require any user parameters and helps the user to move the user back to the previous web page with a browsing history connection.

navigate().forward()

This command lets the user navigate to the next web page based on the history of the browser.

navigate().refresh()

This order would help update the website that is actually in use, so all web components will be reloaded.

Q29) What is MRO in python?
Ans:

Method Resolution order is used in the concepts of inheritance where a class inherits multiple classes, the same method is defined in all parent classes. During run time, it is confused with the child class which method to name. So, to solve the dilemma, the MRO helps.

Q30) What are the different way entering value TextBox?
Ans:

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

other is using Action Class

act=ActionChains(driver)

send_keys_to_element(control,”Valuetobeenterd”)

Q31) Why should Selenium be selected as a test tool?
Ans:

Selenium is free and open source with a wide user base and supports cross-browser compatibility groups with excellent compatibility with the platform (Windows, Mac OS, Linux etc.)

Q32) Explain how python is interpreted?
Ans:

The Python software runs from the source code directly. Each type of code executed by Python programs is needed. Python transforms the programmer’s written source code into an intermediate language, which is again converted into the executed native language of the machine. So, Python is a script that is interpreted.

Q33) How can we perform drag drop in selenium?
Ans:

act=ActionChains(driver)

act.drag_and_drop(sourcelement,targetelement)

Q34) What is the difference b/w findelement and findelements?
Ans:

The first matching element is retrieved by FindElement.

More than one portion is returned by FindElements.

Q35) What are the different ways of selecting the values in dropdown?
Ans:

SelectByValue

selectByVisibleText

selectByIndex

Q36) List some of the test types that are supported by Selenium?
Ans:
  • Integration Testing
  • Smoke Testing
  • Responsive Testing
  • Functional Testing
  • Regression Testing
  • Sanity Testing
  • Cross Browser Testing
Q37) What is Selenium Grid?
Ans:

Selenium Grid makes it possible for you to distribute the experiments and all of them at the same time on different devices. So, using the same text script, you can run Internet Explorer tests on Windows and Safari on Mac computers. It decreases the execution time of the test and provides fast feedback.

Q38) How to input text in the text box using Selenium WebDriver?
Ans:

WebDriver driver = new FirefoxDriver();

driver.get(“https://www.gmail.com”);

driver.findElement(By.xpath(“xpath”)).sendKeys(“Software Testing Material Website”);

Q39) Is Selenium Server needed to run Selenium WebDriver Scripts?
Ans:

We need to use Selenium Server while we distribute our Selenium WebDriver scripts for execution using Selenium Grid.

Q40) How can we handle windows based pop up?
Ans:

Selenium doesn’t support programs dependent on Windows. It is a research platform for automation that only supports testing for web applications. Using some third-party tools like AutoIT, Robot class, etc., we might manage windows-based popups in Selenium.

Q41) What is Page Factory?
Ans:

We have shown that in a test environment,’ Page Object Model’ is a way to view a program. We build a Page Object to reference the ‘page’ for any ‘page’ in the program, whereas a ‘Page Factory’ is one way to enforce the ‘Page Object Model’.

Q42) Differentiate between Type Keys and Type Commands in Selenium?
Ans:

Types Keys uses JavaScript to accumulate the various value attributes while the Style Commands emulate the typing of a real person.

Copyright 1999- Ducat Creative, All rights reserved.