1⟩ What is Selenium?
Selenium is a robust test automation suite designed in a way to support and encourage automation testing of functional aspects of web-based applications and a wide range of browsers and platforms.
“Automation related Frequently Asked Questions by expert members with professional career as Automation. These list of interview questions and answers will help you strengthen your technical skills, prepare for the new job interview and quickly revise your concepts”
Selenium is a robust test automation suite designed in a way to support and encourage automation testing of functional aspects of web-based applications and a wide range of browsers and platforms.
Selenium supports only web based applications testing. So, here are the limitations of it:
☛ Mobile applications cannot be tested using Selenium
☛ Desktop applications cannot be tested using Selenium
☛ Captcha and Bar code readers cannot be tested using Selenium
☛ User should use third-party tools like TestNG or jUnit to write test scripts and generate reports
☛ Programming language knowledge is required to create robust scripts in Selenium WebDriver
Absolute XPath is the direct way to find the element. It has a disadvantage. XPath gets failed if there are any changes made in the path of the element. html/body/div[3]/div/div[1]/div/div/div[1]/div/input - Absolute XPath example.
Mobile Testing Drivers supported by the WebDriver are:
☛ AndroidDriver,
☛ IphoneDriver,
☛ OperaMobileDriver.
submit() method could be used as the alternate way to click on login button, but only if attribute type=submit.
Windows pop-ups cannot be handled by using Selenium. Because it supports only web application testing.
The next Actions class is used to perform right click:
Actions act = new Actions(driver); // where driver is WebDriver type
act.moveToElement(webElement).perform();
act.contextClick().perform();
Code to double click an element in Selenium:
Actions action = new Actions(driver);
WebElement element=driver.findElement(By.id("elementId"));
action.doubleClick(element).perform();
You have to follow the next steps to find broken images in a page using Selenium Web driver:
☛ get XPath and get the all links on the page using the tag name
☛ click on every link on the page
☛ look for 404/500 in the target page title
There are 5 different exceptions Selenium WebDriver:
☛ NoAlertPresentException,
☛ NoSuchElementException
☛ NoSuchWindowException
☛ TimeoutException
☛ WebDriverException
org.openqa.selenium java -cp bin;jars/* org.testng.TestNG testng.xml
You can use recovery scenario in accordance with the programming language.
If it is Java then you can use exception handling to overcome same.
Selenium Grid hub is a central point or a server that controls the test executions on the different machines.
The tests could be debugged in such way:
☛ insert a break point from the location from where you want to execute test step by step
☛ run the test case
☛ test case execution will be paused at the given break point
☛ click on the blue button to continue with the next statement
☛ to continue executing all the commands at a time click on the “Run” button
IntelliJ is an IDE that helps users to write code for Selenium better and faster. It could be used as an option to Java bean and Eclipse.
Automation testing is a process in which software tools execute pre-scripted tests on a software application before it is released into production. Special software is used to control the test execution, actual outcomes and predicted outcomes comparison, the test preconditions setting up, and other test control and test reporting functions.
Selenium IDE is a plug-in used to record and replay tests in Firefox browser. Scripts may be automatically recorded and edited manually providing auto-completion support and the ability to move commands around quickly.
Relative XPath means that user can start from the middle of the HTML DOM structure and no need to write long XPath. Example of Relative XPath - //input[@id='email'].
If you need to type keyboard key values into a text field of the web application, "type" command will be used. Another reason for its usage is selecting values of the combo box. "typeAndWait" command is used when your typing is completed and software web page start reloading.
Both of these methods delay the speed of execution. The main difference between them is setSpeed sets a speed while will apply delay time before every Selenium operation takes place. thread.sleep() will set up wait only for once.
For Example:
☛ sleep(5000)- It will wait for 5 seconds. It is executed only once, where the command is written.
☛ setSpeed("5000")- It also will wait for 5 seconds. It runs each command after setSpeed delay by the number of milliseconds mentioned in set Speed.