Selenium Interview Questions Part 4
Note : You can add questions and answer in comments section after the post. We will add them to the series if not duplicated.
31) Can I build test suite using only Selenium IDE?
Yes, it is possible. We can combine all individual tests into one common suite and there is an option to run the whole suite. But there will be lot of maintenence and time consuming. That’s why, It is recommended to go for Selenium Webdriver.
32) Is it possible to edit the test in Selenium IDE?
Yes, after recording commands we can either directly edit in the table view or in the source code.
33) What does SIDE stands for?
Don’t get confused if someone ask this. Because It is nothing but Selenium IDE?
34) How would you use echo, StoreEvals and StoredVars?
There is detailed post on this with examples. You can read here..
35) Is there any tool which can create the xpath and CSS for me?
You can use Firebug and Firepath for that. This is explained with examples here..
36) How would you handle the page loading if you are not sure how much time that page takes to load?
We can use the pageLoadTimeOut command in Selenium as shown below.
driver.manage().timeouts().pageLoadTimeout(20, TimeUnit.SECONDS);
37) In what kind of situations, selenium gets failed to identify the element on the page?
- Element is not loaded properly
- Element has dynamic property which got changed
38) How Selenium 2.0 configuration is different from Selenium 1.0?
In Selenium 1.0 , we used to start Selenium server which will act as a medium between Browser and selenium commands, So selenium was not able to interact with the browser directly. There were some problems people faced with pop-ups, mouse operations etc. You need to have Selenium server jar file to starts with.
But in Selenium Webdriver, you need to download jar files and upload it to your IDE and you are good to go. It does not need any server to start before testing and it can directly interact with browser which makes performance better.
39) How to click on a hyperlink using selenium?
First you need to identify the element using any locator which helps to identify that element uniquely. If there is only one link you can use either link text or partial link text.
Using link text:
driver.findElement(By.linkText(“Forgot Password?”)).click();
Using partial link text:
driver.findElement(By.partialLinkText(“Forgot”)).click();
40) How to get the text of any particular element in web page?
Sometimes, you will need to get the text of error messages, success messages, or general text for verification in the test script. So, you can use the method ‘gettext()’ to fetch the text of that element as shown below.
String strText = driver.findElement(By.id(“myid”)).getText();