1. What is the difference between “/” and “//” in Xpath?
Single Slash “/” – Single slash is used to create Xpath with absolute path i.e. the xpath would be created to start selection from the document node/start node.
Double Slash “//” – Double slash is used to create Xpath with relative path i.e. the xpath would be created to start selection from anywhere within the document.
2. When should I use Selenium Grid?
Selenium Grid can be used to execute same or different test scripts on multiple platforms and browsers concurrently so as to achieve distributed test execution, testing under different environments and saving execution time remarkably.
3. How do I launch the browser using WebDriver using C#?
The following syntax can be used to launch Browser:
IWebDriver driver = new FirefoxDriver();
IWebDriver driver = new ChromeDriver();
IWebDriver driver = new InternetExplorerDriver();
4. How do I open a url using C#?
5. What menu option do you choose to add Selenium WebDriver package to VisualStudio?
The WebDriver is added to the project by selecting “Tools” Menu > “NuGet Package Manager” > “Package Manager Console”. Also need to install “Selenium Support”, which includes helper .Net classes for the Selenium WebDriver API.
6. What would you need to do to run your test with Chrome with VisualStudio?
To run Selenium tests in Google Chrome, besides the Chrome browser itself, ChromeDriver needs to be installed.
- Installing ChromeDriver is easy: go to http://chromedriver.storage.googleapis.com/index.html
- Download the one for your target platform, unzip it and put chromedriver executable in your PATH.
7. What would you need to do to run your test with IE with Visual Studio?
To run Selenium tests in IE ,
- IEDriverServer is available at http://www.seleniumhq.org/download/.
- Choose the one based on your windows version (32 or 64 bit)
8. What is NUnit?
NUnit, inspired by JUnit, is an open source unit testing framework for Microsoft .NET.
9. What is C#?
C# is an object oriented, type safe and managed language that is compiled by .Net framework to generate Microsoft Intermediate Language.
10. What is the difference between public, static and void?
Public declared variables or methods are accessible anywhere in the application. Static declared variables or methods are globally accessible without creating an instance of the class. The compiler stores the address of the method as the entry point and uses this information to begin execution before any objects are created. And Void is a type modifier that states that the method or variable does not return any value
11. What is an object?
An object is an instance of a class through which we access the methods of that class. “New” keyword is used to create an object. A class that creates an object in memory will contain the information about the methods, variables and behavior of that class.
12. Define Constructors?
A constructor is a member function in a class that has the same name as its class. The constructor is automatically invoked whenever an object class is created. It constructs the values of data members while initializing the class.
13. What is Jagged Arrays?
The array which has elements of type array is called jagged array. The elements can be of different dimensions and sizes. We can also call jagged array as Array of arrays.
14. What is difference between constants and read-only?
Constant variables are declared and initialized at compile time. The value can’t be changed after wards. Read-only variables will be initialized only from the Static constructor of the class. Read only is used only when we want to assign the value at run time.
15. Write down the C# syntax to catch exception?
To catch an exception, we use try catch blocks. Catch block can have parameter of system.Exception type.
16. What are the types of comments in C# with examples?
Single line (//)
Multiple line(/* */)
XML Comments (///)
17. What are value types and reference types?
Value types are stored in the Stack whereas reference types stored on heap.
int, enum, bytes, decimal, double, float, long
string, class, interface, object
18. Is C# code managed or unmanaged code?
C# is managed code because Common language runtime can compile c# code to Intermediate language.
19. Types of Constructors
Basically constructors are 5 types those are
20. Data Types in C#?
bool, byte, char, decimal, double, float, int, long, sbyte, short, unit, ulong, ushort
21. Feature of C# language?
Automatic Garbage Collection
Properties and Events
delegates and Events Management
LINQ and Lambda Expressions
Integration with Windows
22. What is a Class?
A set or category of things having some property or attribute in common and differentiated from others by kind, type or quality.
23. What is Page Object Model?
- Page Object Model is a design pattern to create Object Repository for web UI elements.
- Under this model, for each web page in the application there should be corresponding page class.
- This Page class will find the WebElements of that web page and also contains Page methods which perform operations on those WebElements.
- Name of these methods should be given as per the task they are performing i.e., if a loader is waiting for payment gateway to be appear, POM method name can be waitForPaymentScreenDisplay().
24. What are the alterntives to Page Object Model?
- Module Based Testing Framework
- Library Architecture Testing Framework
- Data Driven Testing Framework
- Keyword Driven Testing Framework
- Hybrid Testing Framework
- Behavior Driven Development Framework
25. What are key differences between xUnit, NUnit and MSTest. Which one is better?
xUnit.net is a free, open source, community-focused unit testing tool for the .NET Framework.
NUnit is a unit-testing framework for all .Net languages.
MSTest is a command line utility from Microsoft that executes unit tests created in Visual Studio 2005, 2008, 2010 and is still available for backwards compatibility with older versions in Visual Studio 2012 and 2013.
26. What is the benefit of calling driver.manage().window().Maxamize()?
The WebDriver class provides the window interface for setting up the browser window size, state, and so on. When we call the maximize() method, the browser will maximize in size and run test on maximized window.
27. What are limitations of Selenium?
Some limitations of Selenium Automation tool are as follows:
- It does not support and non web-based applications, it only supports web based applications.
- Its and open source tool so in case of any technical issues you need to rely on the selenium community forums to get your issue resolved.
- You need to know at least one of the supported language very well in order to automate your application successfully.
- No inbuilt reporting capability so you need plugins like JUnit and TestNG for test reports.
- Lot of challenges with IE browser.
28. Can we write single automation using Selenium that runs for any browsers including the mobile browsers?