Selenium Faq's



1. What is automation and advantages of automation

A. The process of converting the manual test cases to test scripts by using any automation tools is known as automation.
Advantages:
1. It saves time by executing the test cases without manual effort
2. CTC (Cost to the company)can be saved.
3. We can maintain accuracy by repeating the same task in same manner.
4. Bugs can be Identified.
5. We can report the bugs to the developer.
6. We can ensure for quality.

2. What are the components  available in Selenium 

A. Selenium contains 4 components.
                1. Selenium IDE
                2.Selenium Web Driver
                3.Selenium RC
                4.Selenium Grid
3. Why should we go for Selenium instead of Qtp
                                (or)
How is Selenium different from commercial browser automation tools?

A. 1.Selenium is an open source automation tool
2. It supports multiple languages like Java, C#, Perl, Python, Ruby, HTML
3. It supports multiple browser Google chrome, Safari, Opera and ,IE
4. Supports Windows, Linux and Mac
5. Supports Web and mobile applications.
6. It's very flexible and extendable.

4.What is Selenium IDE

A.1.IDE stands for integrated Development environment.
2.It is for record and run the scripts.
3.Selenium IDE is an add on for Firefox
4.Its accountable for user actions
5.Recorded script can be viewed in the supported languages like HTML, JAVA, C#, Ruby, Python.
6.Recorded  script can be run against other browsers also by using Selenium RC or Web driver

5.How to capture screen shot in web driver.

A. We can capture screenshot by using below two lines:
File scrFile=((TakesScreenshot)driver.getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, newFile(“D:\\screenshot.png”));

6.How to maximize the browser in Webdriver.

A. driver.manage().window().maximize();

7.How to run Selenium server from command prompt.

A.1. Go to command prompt.
2. Give the path, Where the selenium server is saved
                ex:cd E:Library
3. Use the command “java –jar selenium-server-standalone-
2.44.0.jar”

8.What is Selenium RC

A. RC stands for remote control. It is a server and it launches browsers. It acts as API and library. It controls the entire automation.

9.How many test cases can be automated per day.

A. It always depends on the application and test cases. But on and average we can automate 5 to 6 test cases per day.
Ex:1. For analyzing the test cases
 2.Developing the script
3.Stabilizing the script.

10. What challenges you have faced with selenium.

A. Challenge means problems or issues
1.Maintaining synchronization is a challenge in Selenium.
2.Handling Desktop ,Flex, Flash elements with selenium.
3.Proving the user defined results a challenge.
4.Taking the data from the application is a challenge.

11.How to handle SSL Certificate issue in Firefox with Webdriver (or)How do you handle the secured connection error in HTTPS?

A.FirefoxProfile profile=new FirefoxProfile();
Profile.setAcceptUntrustedCertificates(true);
Profile.setAssumeUntrustedCertificateIssuer(false);
Driver=new FirefoxDriver(profile);

12. What is the latest version of Selenium available.

A.Selenium-server-standalone-2.45.o.jar

13. How  to handle SSL certification issue in IE

A. Add the below command after opening the browser.
Driver.navigate().to(“javascript:document.getElementById(‘overridelidriver.navigate().to(“javascript:document.getElementById(‘overridelink’).click()”);

14. How to change the port number for Selenium RC

A.Syntax: -jar seleniumJarfileName –port anyFourdigitNo
Ex:-jar selenium-server-standalone-2.44.0.jar –port 1234

15. How do you start Selenium RC from command prompt?

A.1. Save the selenium jar file(Selenium-server-standalone-2.34.0.jar)in any folder(Ex              :D:/Library)
2. Open command prompt.
3. Navigate to the path where you saved the jar file and follow the below steps
D:
   cd D://Library
java –jar selenium-server-standalone-2.44.0.jar

16. What locators available in Selenium RC

A. ID
Name
CSS(Cascade style sheet)
XPATH(Relative xpath and absolute path)
Dom

17. What locators available in selenium Webdriver

A.ID
Name
CSS
XPath
Classname
TagNAme
LinkText
PartialLink Text

18. How to create Default Selenium object and what parameters needs to be pass 

A.DefaultSelenium selenium=newDefaultSelenium(“localhost”,4444,”*firefox”,”http://’’);
Localhost=It is the machine name and selenium server should be configured in the specific machine
4444-Its selenium port number.
*firefox-Its is the command to a launch firefox
http:// -Protocol to open URL

19. How many types of XPaths are available

A. XPath is of two types:
1.Relative XPath
2.Absolute XPath

20.What is the difference between single and double slash in XPath.

A.”//” is the starting point of the XPath.
:/”will navigate in to the tag.
Ex://html/head/body/div1/div2/…..

21. How to handle Alerts and Confirmation Alerts in WebDriver 

A. We have to navigate  to Alert or confirmation as below,
driver.switchTo().alert()
To click or cancel on alert or confirmation Alert then follow as below
driver.switchTo().accept();-To click OK
driver.switchTo().alert().dismiss();-To click Cancel

22. How to handle Popup in Webdriver.

A. We have to navigate to the popup as below
driver.switchTo().window(“Window.Name”);
To navigate from Popup to main window
driver.switchTo().window(“Main Window Name”);

23. How  to handle dynamically changing popup in webdriver

A. Dynamic means the Name is not constant. It changes frequently
Use the below approach to handle Dynamically changing popup
Set<String>s=driver.getWindowHandles();
Object popup[]=s.toArray();
driver.switchTo().window(poup[1].toString());

24. Is it possible to handle the multiple popup in webdriver 

A. Yes
We can handle it by using multiple popup in webdriver.
driver.getWindowHandles();

25. How to capture window name

A. driver.getWindowHandle();

26. How to launch Firefox,Safari and Opera with Webdriver

A. Firefox,Safari and Opera we be launch by using below commands.
WebDriver driver=new FirefoxDriver();
WebDriver driver=new OperaDriver();
WebDriver driver=new SafariDriver();

27. How  to launch Internet Explore.

A. For IE, We need the supported “Internet Explorer Driver Server". It can be downloaded from the below site:
http://docs.selenium hq.org/download/
Below code is to launch IE.
System.setProperty(“webdriver.ie.driver”,”E://Library\\IEDriverServer.Exe”);
“E.\\Library\\IEDriverServer.exe”);
driver=new InternetExplorerDriver();
driver.get("http://gmail.com”);

28. How to launch Google chrome

A. For Google chrome, We need the supported “ChromeDriver”
Exe file. Can be downloaded from the below site:
Below code is to launch Google chrome
System.setProperty(“webdriver.chrome.driver”,”E:\\Library\\chromedriver.exe”);
driver=new ChromeDriver();
driver.get(“http://gmail.com”);

29. Brief about the Disadvantages of Selenium

A. Selenium supports webappliactions.It doesn’t support Desktop applications.

30. How to handle Desktop, Flex and Flash objects in Selenium .

A. We can use SIKKULI as an add-on for selenium to support Desktop, Flex and flash objects.
Sikuli is an open source automation tool developed on JAVA can be downloaded from:https://launchpad.net/sikkuli/+download

31. How  to take data from excel(xls)file

A. FileInputStream fi=new FileInputStream(“Path of the excel file”);
Workbook w=Workbook.getWorkbook(fi);
Sheet s=w.getSheet(0);
It will read the excel file up to the sheet. To take the data from sheet use below command.
s.getCell(columned,rowID).getContents())
ex:s.getCell(0,1).getContents();

32. How  to create Excel file

A. FileOutputStream fo=new FileOutputStream(“Path to create xls file”);
WritableWorkbook wb=Workbook.create Workbook();
WritableSheet ws=wb.createSheet(“Results”,0);
Label un=new Label(0,0,”Username”);
Ws.addCell(un);
Wb.write();
Wb.close();

33. How to print data from notepad(txt file)

File f=new File(“E:\\data2.txt”);
FileReader fr=new BufferReader(fr);
Stringstr;
While((str=br.readLine())!=null))
{
System.out.println(str);
}
34. How to create and write data in to txtfile
File f=new File(“E:\\data2.txt”);
FileWriter fw=new FileWriter(f);
BufferedWriter bw=new BufferedWriter(fw);
bw.write(“sreekanth”);
bw.newLine();
bw.write(“hyderabad”);
bw.newLine();
bw.write(“AP”);
bw.close();
fw.close();

35. How  to take or print data from XML file

File f=new File(“D://file.XML”);
DocumentBuilderFactory dbFactory=DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder=dbFactory.newDocumentBuilder();
Document doc=dBuilder.parse(fXmlFile);
Doc.getDocumentElement().normalize();
System.out.println(“Root element :”+doc.getDocumentElement().getNodeName());
NodeList nList=doc.getElementsByTagName(“staff”);
System.out.println(“---------------------------”);
for(int temp=0; temp<nList.getLength();temp++)
{
Node nNode=nList.item(temp);
System.out.println(“\nCurrentElement :”+nNode.getNodeName());
If(nNode.getNodeType()=Node.ELEMENT_NODE)
{
Node nNode=nList.item(temp);
System.out.println(“\nCurrentElement:”+eElement.getAttribute(“id”));
Element eElement=(Element)nNode;
System.out.println(“Staffid :”+eElement.getAttribute(“id”));
System.out.println(“FirstName :”+eElement.getElementsByTagName(“firstname”).item(0).getTextContent());
System.out.println(“LastName :”+eElement.getElementsByTagName(“lastname”).item(0).getTextContent());
System.out.println(“Nick Name :”+eElement.getElementsByTagName(“nickname”).item(0).getTextContent());

System.out.println(“Salary :”+eElement.getElementsByTagName(“salary”).item(0).getTextContent());
}
}

36. What is Ant or Apache Ant

Ant is a java based build management tool. The process of converting the source code to software system(executable code)is known as build. There are number of steps to convert the source code to executable code. Ant will manages all the steps with Build.xml file. Steps to convert the source code to software.
1.Taking the source code from src repository.
2. Preparing the build area.
3. Compiling the source code.
4.Build the compiled  code to executable code.

37. What is Maven

Maven is also Java based build management tool. It is the advanced version of Ant.


38. What is the differences between Ant &Maven

1. Maven is widely preferred than Ant. Ant is an order tool.
2. It doesn’t come with formal conventions such as common project directory. Maven consists of conventions.
3. Ant is procedural. Maven is declarative. It means in Ant, you have to specify the order what should have to be done ,where as Maven takes care of all the directions once the files are stored in the po.xml file.
4. Another difference that can be seen is that Ant does not have a lifecycle whereas Maven has a lifecycle.
5. The scripts in Ant are not reusable whereas Maven comes with reusable plug-in.

39. What are the disadvantages of using Selenium as testing tool.

It doesn’t support desktop or windows based applications. But we can overcome by using tools like SIKKULI or Auto IT.

40. How do you handle Ajax controls using selenium? E.g. typing in search engine how  do you capture the auto suggestion

A. Ajax control means when we enter some text in the Google textbox, it display the auto suggested values. The textbox is an Ajax control.
Type the value in the textbox and capture all the suggested values in a string.
Split the string and take the values.

41. How  do you select the end item in a List box or drop down.

A.newSelect(driver.findElement(By.id(“id”))).selectByindex(index);

42. Brief about your framework

A. Its hybrid framework where it’s a combination of Keyword driven (TestNG) and Data driven framework. Advantage of Hybrid framework is, we can utilize the advantages of both keyword driven and Data driven frameworks.


43. What is the difference between assert and verify commands/

A. Verify command will not stop execution of test case if verification fails. It will log an error and proceed with execution of rest of the test case. Assert command will stop execution of test case if verification fails. It will log an error and proceed with execution of rest of the test case.

44. Explain about your reporting method

A.Bug reporting is always a amnual process.Getting the test report from the automation tool and analyze the report for bugs.If Identified,report the bugs by using QC or Bugzilla or JIRA

45. What is the difference between Selenium RC and Webdriver

A. 1. We can access all the latest browsers.
2. Not necessary to start the selenium server to run the webdriver programs
3. Webdriver by default maintains page load synchronization ,for page refresh we need to handle it.
4. Its executing auto scroll down action in to the application while executing the script
5. We can develop both webdriver commands and RC in a single class.
6. We can effectively take the information from application.

46. What are all the things cannot be done through selenium IDE

A. We can't perform below testing's
1. Regression testing
2. Retesting
3. static testing's like GUI and Validations
4. DB Testing
5. It doesn’t provide test report.

47. Brief about Selenium grid

A. It is for parallel execution. We can launch all the browsers parallelly and the scripts can be executed on it parallelly.

48. How to use selenium for performance testing 

A. Selenium is functional testing automation tool. It’s not for performance testing. We can generate only the load by using selenium.

49. How to get all the links in HTTP://Google.co.in

A. Link means anchor tag in any application. Identify all the links by using find elements and tag name. Get all the links to list variables and take the targeted link by using for loop and if condition.

50. Is it possible to handle multiple popups in selenium?

A. Yes, We can handle with the command getWindowHandles(). Take all the window names into Set<String> variable and convert it to array. Use the array index to navigate to specific window by using driver.switchTo().window(ArrayIndex;)

51. Difference between JUnit and TestNg Framework 

A. Junit vs TestNg
1. We need to implement all the test methods very independently in JUnit. Not necessary in TestNg.
2. Junit contains very limited Annotations like @Before class, @Before,@Test,@After and @Afterclass.
TestNG contains multiple Annotations like @BeforeSuite,@BeforeTest,@BeforeClass,@BeforeMethod,@Test,@AfterMethod,@AfterClass,@AfterTestand @AfterSuite
3. TestNG provides html result file default where as in Junit it won't provide html result file by default.

52. If the default port of selenium is busy then which port you will use?

A. Selenium by default uses 4444portno.If the port is already used by any other server then we can change it to any other 4 digit no
Ex:5555 or 1234 or 6666

53. how much time we can save with automation.

A. It always depends on the project and test cases. But on and average we can save around 50% to 60% of the time.

54. What is automation lifecycle or automation approach or automation plan

A. Do the POC for the project
2. Execute or review all the manual test cases to get the functional knowledge of the project and to identify the test cases for automation.
3. Develop the framework.
4. Prepare the test scripts for all the identified test cases
5.Integrate the scripts with framework for execution
6. Before executing identify the build changes, if available update the scripts.
7.execute the scripts and capture all the results in separate folder
8. Analyze the test report and identify the bugs.
9.Report the bugs manually to the developer by using some reporting tool.

55. Write a program to get all the textboxes in mail. In register page with webdriver.

A. List<WebElement>
Str=driver.findElements(By.tagName(“textbox tagname”));
System.out.println(str.size());
for(int i=0;i<str.size();i++)
{
System.out.println(str.getAttribute(“id”));..To prnt ids
}

56. How  to execute scripts on other machines remotely

A. URL url=new URL(“http”,”localhost”,4444,”/wd/hub”);
DesiredCapabilities capabilities=DesiredCapabilities.Internetexplorer();
Capabilities.setJavascriptEnabled(true);
WebDriver driver=newRemoteWebDriver(url.capabilities);
driver.get(“http://www.google.com”);
Note:Provide IP address of other machines instead of localhost

57. How to Mouse over on one element by using webdriver 

A. WebDriver driver=new FirefoxDriver();
driver.manage().window().maximize();
driver.get(“http://spicejet.com”);
Actions a=new Actions(driver);
webElement str=driver.findElement(By.linkText(“About Us”));
a.moveToElement(str).build.perform();

58. How to scroll down and scroll up in the browser 

A. webdriver driver=new FirefoxDriver();
Driver.manage().window().maximize();
Actions a=new Actions(driver);
a.KeyDown(Keys.CONTROL).sendKeys(keys.END).build().perform();
Thread.sleep();
a.KeyDown(Keys.CONTROL).sendKeys(Keys.HOME).build().perform();
a.KeyDown(Keys.ALT).sendKeys(Keys.F1).build().perform();

67 comments :

  1. Thanks for sharing this kind of blogs. Its is very useful for all the readers.
    keep sharing more blogs

    selenium Training in chennai

    ReplyDelete
  2. you have posted such an informative blog. it will be really helpful to many peoples. you have detail explained about the blog.
    selenium training in chennai

    ReplyDelete
  3. Nice collection of interview questions. I got more information about selenium openings in hyderabad. Keep on updating content up-to-date and regularly.

    ReplyDelete
  4. Selenium WebDriver fits in the same role as RC did, and has incorporated the original 1.x bindings. It refers to both the language bindings and the implementations of the individual browser controlling code. This is commonly referred to as just "WebDriver" or sometimes as Selenium 2.
    Selenium Training Institute in Chennai


    Best Selenium Training Institute in Chennai |
    Selenium Training in Velachery

    ReplyDelete
  5. have read your blog and i got a very useful and knowledgeable information from your blog.You have done a great job . If anyone want Java Training in Chennai, Please visit our page


    Selenium Training in Bangalore

    ReplyDelete
  6. Hello Sreekanth,

    I found your blog while searching for selenium interview questions, I happy to be here. Very useful content and also easily understandable providing.. Believe me I did wrote an post about "Important Selenium Interview Questions" with reference of your blog. Also check here for latest updates of Selenium Tutorials & here is the link for complete selenium topics to learn to be a professional selenium tester.

    ReplyDelete
  7. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end. Software Testing Training in Chennai | Selenium Training in Chennai

    ReplyDelete
  8. Really nice article...Selenium is a portable software-testing framework for web applications. Selenium provides a record/playback tool for authoring tests without the need to learn a test scripting language.
    Wish to learn Selenium from the basics to the advanced level, enroll you in the Best Software Training Institute in Velachery, to learn quickly.
    Selenium Testing Training in Velachery | Best Selenium Testing Training Institute in Velachery

    ReplyDelete
  9. And indeed, I’m just always astounded concerning the remarkable things served by you. Some four facts on this page are undeniably the most effective I’ve had.

    selenium training in chennai|

    ReplyDelete
    Replies
    1. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.

      Data Science Training In Bangalore

      Delete
  10. This comment has been removed by the author.

    ReplyDelete
  11. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here
    "Oracle Training in Chennai"

    ReplyDelete
  12. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this


    java training in chennai


    java Training in Bangalore





    big data Training in Bangalore

    ReplyDelete
  13. Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital informationSelenium

    Training in Chennai

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. feeling so good to read your informations in the blog.
    thanks for sharing your ideas with us and add more info.
    AWS Web Services Training in Bangalore
    AWS Certification Training in Anna nagar
    AWS Training in Guindy

    ReplyDelete
  16. This comment has been removed by the author.

    ReplyDelete
  17. Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on updating...

    Guest posting sites
    Education

    ReplyDelete
  18. Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information.
    Ethical Hacking Course in Chennai 
    Hacking Course in Chennai 
    Ethical Hacking Training in Chennai 
    Certified Ethical Hacking Course in Chennai 
    Ethical Hacking Course 

    ReplyDelete
  19. This is a good post. This post give truly quality information. I’m definitely going to look into it. Really very useful tips are provided here. thank you so much. Keep up the good works.
    Selenium Training in Chennai
    Selenium classes in chennai
    Selenium testing training in chennai
    Selenium course
    Software testing selenium training
    Selenium testing training

    ReplyDelete
  20. It is very excellent blog and useful article thank you for sharing with us, keep posting.

    Ethical Hacking Course
    Ethical Hacking Certification
    Hacking Course
    Learn Ethical Hacking

    ReplyDelete
  21. your blog information's are really creative and It contains full of new innovative ideas.
    thank you for sharing with us.please update more data.
    Cloud computing institutes in Bangalore
    cloud computing courses near me
    cloud computing Training in chennai
    Cloud Computing Training in OMR

    ReplyDelete
  22. Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on
    updating...

    Article submission sites
    Education

    ReplyDelete
  23. Truly an amazing article. Enjoyed every bit of it. Keep posting!
    Data Analytics Courses in Bangalore

    ReplyDelete
  24. Great Post. Your article is one of a kind. Thanks for sharing.
    You will get an introduction to the Python programming language and understand the importance of it. How to download and work with Python along with all the basics of Anaconda will be taught. You will also get a clear idea of downloading the various Python libraries and how to use them.
    Topics
    About ExcelR Solutions and Innodatatics
    Do's and Don’ts as a participant
    Introduction to Python
    Installation of Anaconda Python
    Difference between Python2 and Python3
    Python Environment
    Operators
    Identifiers
    Exception Handling (Error Handling)

    ReplyDelete
  25. Thank you so much for taking effort to share such a useful information.
    selenium classes in pune hadapsar

    ReplyDelete

  26. Very useful blog thanks for sharing IndPac India the German technology Packaging and sealing machines in India is the leading manufacturer and exporter of Packing Machines in India.

    ReplyDelete
  27. Great Article. Thank you for sharing! Really an awesome post for every one.

    IEEE Final Year projects Project Centers in Chennai are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation. For experts, it's an alternate ball game through and through. Smaller than expected IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble. Final Year Project Domains for IT It gives you tips and rules that is progressively critical to consider while choosing any final year project point.

    JavaScript Training in Chennai

    JavaScript Training in Chennai


    ReplyDelete
  28. Very informative and creative content. This concept is a good way to enhance the knowledge.thanks for sharing
    UI Path Online Training
    UI Path Training in Hyderabad

    ReplyDelete

  29. Thank you so much for this nice information. Hope so many people will get aware of this and useful as well. And please keep update like this.selenium Training in pimple saudagar

    ReplyDelete
  30. A very nice guide.it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    Machine Learning Training in Hyderabad

    ReplyDelete
  31. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here

    Big Data Analytics Training In Hyderabad
    Big Data Analytics Course In Hyderabad

    ReplyDelete
  32. This article is very much helpful and i hope this will be an useful information for the needed one.Keep on updating these kinds of informative things.Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.

    oracle training in chennai

    oracle training institute in chennai

    oracle training in bangalore

    oracle training in hyderabad

    oracle training

    oracle online training

    hadoop training in chennai

    hadoop training in bangalore


    ReplyDelete
  33. Say, you got a nice article post.Really thank you! Really Great.
    selenium online trainings
    selenium trainings

    ReplyDelete
  34. Want To Trade Forex With AVATRADE REVIEW ? Read This Blog First To Find Out About The Best Forex Trading Conditions. We Review The Most Popular Forex Brokers And Tell You What You Need To Know.

    ReplyDelete
  35. This post is so helpfull and informative.keep updating with more information...
    Automated Testing Selenium
    Selenium Tools

    ReplyDelete
  36. Solulever, a Dutch technology startup, aims at bringing the revolution of Industry 4.0 to its customers by aligning them with sustainability performance. Brabo, a manufacturing connectivity and intelligence platform developed by Solulever, aims at integrating smart manufacturing at the existing manufacturing sites in a sustainable manner.
    https://solulever.com/brabo

    ReplyDelete