1. When I start my firefox driver, I like to have the home page is loaded as my project URL . How do I do that without using driver.get method?
Ans: driver.navigate().to() method
Ans: driver.navigate().to() method
2. Name the selenese commands for the following actions:
- Enter value in text field
- Select a radio button
- Check if the object is loaded
- Verify a content in a page
- Verify the title of a page.
3. What do you know about Selenium? How long you are working with Selenium and what version?
Ans:
Ans:
- Selenium is an open source functional testing tool that automates browsers; It is a tool and an API for testing browser-based applications that rely on HTML and JavaScript.
- I have been working on selenium webdriver for more than 1 year
4. What are the technical challenges that you faced with selenium?
Ans:
Ans:
- There are quite a few technical challenges we faced in the initial stages of implementation; as SBIGI's core insurance application (eBao a Chinese product) has a restriction - it opens only in Internet Explorer. With this said, locating the UI elements (test objects) via., developer tools & view source which was really challenging.
- Also there are many of the objects which doesn’t have the id, name; also the application is mostly in form tables, so we had to go for Xpath-Relative using developer tools post that we found an Fire-IEBrowser1.4 (VB Scripted excel) that helped in getting the Xpath-absolute & relative very easily.
- We had many obstacles in locating few UI Elements, for which we have used AUI.
- It took almost 20 working days to sort out all the issue and finish an end to end business transaction; with all the solutions found to the major problems we had automated all the 21 live stream products within a short span of time.
- Also mention about other challenges in action builder, selenium crashes, non-support to window handles, file uploads, IDE to webdriver conversion challenges etc
5. What are the test types supported by Selenium?
Ans:
Selenium supports UI and functional testing. As well it can support performance testing to reasonable load
Ans:
Selenium supports UI and functional testing. As well it can support performance testing to reasonable load
- 6. Does Selenium support mobile internet testing?
Ans:- Yes, Selenium Webdriver supports mobile internet testing on Android, IOS operating systems.
- Android – for phones and tablets (devices & emulators)
- iOS for phones (devices & emulators) and for tablets (devices & emulators)
7. 4. Does Selenium support Google Android Operating System? What mobile devices it may support?
Ans:
Yes Selenium supports Android OS. It supports all the mobile devices operating on all versions of Android OS.8. What is Selenese?
Ans:
Selenese is HTML language based command, which is used in Selenium IDE.9. How do you connect Database from selenium?
Ans:- Selenium doesn’t support interacting with the external entities like database, for which we need an external Java API library to connect to DB.
- Below are the steps to connect to DB:
- Initialize drive name and database URL.
- Declare Database credentials
- Register JDBC driver
- Open a connection
- Execute a query
- Extract data from result set
- Clean-up environment (Close record & statement).
- Mention as well about the jdbc driver that you are using
10. What test can Selenium do?
Ans:- Selenium IDE/RC/Webdriver supports in testing the functionality of the web-based applications.
- Selenium Grid - allows distribute tests across browsers and machines(of different OS) of your choice.
- When asked about browsers and OS – be appropriate with names and versions
- 11. What is difference between QTP and Selenium?
Ans:
Category | QTP | Selenium / Web-Driver
License Type | Commercial Software | Open Source
Scripting Language | VB script | Java, Python, Ruby, C#, JS, Perl
Browsers Support | IE, FF(for running), Chrome, Android, iOS | IE, FF, Safari, Opera, Chrome, Android, IOS
Supporting App's | WebApp's, SAP, Activex, Windows, Siebel | Only Web Applications, Flex
Supporting OS | Windows | Windows, Linux, Mac- QTP allows storing of objects using OR and Se works in descriptive mode only as of today.
- Se does not support the window dialog boxes as it can work only in web.
- Se supports the largest number of browsers and multiple OS whereas QTP doesn’t
- Selenium support wide programming languages whereas QTP supports Vbscript only.
- QC-QTP integration allows easier management; Se can integrate with Jira, others
12. What are the types of text patterns available in Selenium?
Ans:
- Like locators, patterns are a type of parameter frequently required by Selenese commands. Examples of commands which require patterns are verifyTextPresent, verifyTitle, verifyAlert, assertConfirmation, verifyText, and verifyPrompt. And as has been mentioned above, link locators can utilize a pattern. Patterns allow you to describe, via the use of special characters, what text is expected rather than having to specify that text exactly.
There are three types of patterns: globbing, regular expressions, and exact.
For more information on Patterns please go through this: http://seleniumhq.org/docs/02_selenium_ide.jsp#matching-
text-patterns
Use text patterns when there is a necessity of using pattern matching context due to dynamic value representation13. What are the disadvantages of using Selenium as testing tool?
Ans:
I would say there would be more challenges while using selenium as testing tool rather than disadvantages: below would be some of the major challenges that I know of- Script Development would be challenging when selenium breaks as we get a minimal or no support at times being opensource.
- Integrating with other external tools such as test management would be challenging.
- Framework development shall be very complex at the beginning as none is available as professional and stable!
- only web, file uploads (window handlers) does not work, changing object properties may be difficult to manage,
- Not so tester friendly at this stage
14. How do you handle the secured connection error in HTTPS?
Ans:15. List the browsers, OS supported by the Selenium
Ans:
Browser | Windows | Linux | Mac
IE | Y | NA | NA
FF | Y | Y | Y
Safari | Y | N | Y
Opera |Y | Y | Y
Chrome | Y | Y | Y- Android – 2.3+ for phones and tablets (devices & emulators)
- iOS – 3+ for phones (devices & emulators)
- Selenium supports all the above browsers, OS with an Y flag.
- 16. Does selenium support flex? How does it understand those objects?
Ans:- Yes it do supports unofficially.
- Flex is an add-on on top of your browser. For flash videos etc.
- FlashSelenium API in Selenium RC helps us to test flash/flex based applications using RC.
- While in webdriver, you need to make your own custom Javascript Execution functions in order to test flash applications using Selenium. But in order to test such applications, you need to make sure that you have the access to source code of the application. This means that you cannot just go and test any flash application present on the internet.
- It is unofficially supported I have seen it on internet. But I have technically not worked on it.
17. When you have selenium issues, what approach you take to resolve it?
Ans:
This would be the most panic moment as selenium doesn’t have any official support. As far as I am concerned I'd take the below approach:- Identify the root cause, is it related to
- Selenium version Sync with the browser.
- Browser related issue; if yes, sync it with the supporting selenium version.
- If it is related to object identification I would rather take an experts opinion on it.
- Finally, post the query in the Selenium Forums for the solution.
My suggestion is that to mention that I would read the exception to identify the root cause of the issue and then explore the source code of the selenium jar to locate the real issue. May work with my development team to see a quick fix else may post in the forum for solution. At times, I find workarounds to move forward else may request my customer to drop the testcase from automation or may postpone the scripting for such challenging scripts.18. What languages are supported for the selenium development?
Ans:- I would say Java and C# are the forefront languages for the selenium. However it also supports Python, Ruby, PHP, Perl, JS.
- C# does not support beyond Windows. I recommend Java to be the only largest used languages here.
19. Name 5 different exceptions you had in selenium webdriver and mention what instance you got it and how do you resolve it?
WebDriverExceptionWebDriver Exception comes when we try to perform any action on the non-existing driver. WebDriver driver = new InternetExplorerDriver(); driver.get("http://google.com"); driver.close(); driver.quit();
NoAlertPresentExceptionWhen we try to perform an action i.e., either accept() or dismiss() which is not required at a required place; gives us this exception. try{ driver.switchTo().alert().accept(); } catch (NoAlertPresentException E){ E.printStackTrace(); }
NoSuchWindowExceptionWhen we try to switch to an window which is not present gives us this exception: WebDriver driver = new InternetExplorerDriver(); driver.get("http://google.com"); driver.switchTo().window("Yup_Fail"); driver.close(); In the above snippet, line 3 throws us an exception, as we are trying to switch to an window that is not present.
NoSuchFrameExceptionSimilar to Window exception, Frame exception mainly comes during switching between the frames. WebDriver driver = new InternetExplorerDriver(); driver.get("http://google.com"); driver.switchTo().frame("F_fail"); driver.close(); In the above snippet, line 3 throws us an exception, as we are trying to switch to an frame that is not present.
NoSuchElementExceptionThis exception is thrown when we WebDriver doesn’t find the web-element in the DOM. WebDriver driver = new InternetExplorerDriver(); driver.get("http://google.com"); driver.findElement(By.name("fake")).click();
TimeoutExceptionThrown when a command does not complete in enough time.
20. How will you execute your login script using chrome browser from your editor using selenium?
Ans:- Download the chromedriver from this path: http://code.google.com/p/chromedriver/downloads/list and store in the directory
- For Chrome browser we need to set the chromedriver path in the editor which is as shown below:
System.setProperty("webdriver.chrome.driver","C:\\Users\\Public\\Documents\\Selenium\\chromedriver.exe"); WebDriver driver = new ChromeDriver();
- 21. How do you create html test report from your test script?
Ans:
I would see below ways:- Junit: with the help of ANT.
- TestNG: using inbuilt default.html to get the HTML report.
- Also XLST reports from ANT, Selenium, TestNG combination.
- Using our own customized reports using XSL jar for converting XML content to HTML.
22. How do you manage the code versions in your project?
Ans:
- We managed code versions in our project using tortoise SVN. This can even be done with Github - online version control tool.23. What are the other tools that you have used to successfully implement selenium in your project and for what as well?- Sikuli: Sikuli Script automates anything you see on the screen. It uses image recognition to identify and control GUI components. It is useful when there is no easy access to a GUI's internal or source code. (Specifically for file uploads)
- We have used when objects doesn’t have any source code. Very easy to use.
24. Have you worked in Maven, Junit, TestNG?
Ans:- Yes I have worked on TestNG, however I have very good knowledge on Maven, Junit as well.
- Maven: Maven is used to maintain the updated versions of jar files in your selenium framework across the team with ease.
- Junit: Junit is actually a framework for unit testing. Selenium along with ANT and Junit can produce very good HTML reports. Mention about Junit structure to allow the pre and post script functionality
- TestNG: Similar to Junit this is also a testing framework. It is very easy to run the testcases parallely. Also TestNG XLST reports are very famous and are easy to generate with the combination of Selenium, ANT, TestNG.
- 19. How to use regular expressions in Selenium?• Regular expression patterns are the most powerful of the three types of patterns thatSelenese supports. Regular expressions are also supported by most high-level programminglanguages, many text editors, and a host of tools, including the Linux/Unix command-lineutilities grep, sed, and awk. In Selenese, regular expression patterns allow a user to performmany tasks that would be very difficult otherwise. For example, suppose your test neededto ensure that a particular table cell contained nothing but a number. regexp: [0-9]+ is asimple pattern that will match a decimal number of any length.• Mention example for text patterns19. I like to know all the methods supported in webdriver and its syntax. Where do you think youcan find it?• In Org.openqa.selenium package, webdriver interface has all the main methods that canbe used in Selenium Webdriver.
Selenium WebDriver Exceptions
ElementNotVisibleException: Thrown to indicate that although an element is present on the DOM, it is not visible, and so is not able to be interacted with.IllegalLocatorException: Deprecated Superseded by InvalidSelectorExceptionImeActivationFailedException: Indicates that activating an IME engine has failed.ImeNotAvailableException: Indicates that IME support is not available.InvalidCookieDomainException: Thrown when attempting to add a cookie under a different domain than the current URL.NoAlertPresentException: Indicates that a user has tried to access an alert when one is not present.NoSuchElementException: Thrown by WebDriver.findElement(By by) and WebElement.findElement(By by).NoSuchFrameException: Thrown by WebDriver.switchTo().frame(int frameIndex) and WebDriver.switchTo().frame(String frameName).NoSuchWindowException: Thrown by WebDriver.switchTo().window(String windowName).SessionNotCreatedException: Indicates that a session could not be created.StaleElementReferenceException: Indicates that a reference to an element is now "stale" --- the element no longer appears on the DOM of the page.TimeoutException: Thrown when a command does not complete in enough time.UnableToSetCookieException: Thrown when a driver fails to set a cookie.UnsupportedCommandException: Used to indicate that a command used by the remote webdriver is unsupported.- close(): Close the current window, quitting the browser if it's the last window currently open.
Driver.close();
findElement(By by): Find the first WebElement using the given method.Driver.findElement(By.id("q"))
findElements(By by): Find all elements within the current page using the given mechanism.Driver.findElements(By.classname("combo-item")
get(java.lang.String url): Load a new web page in the current browser window.Driver.get("http://google.co.in")
getCurrentUrl(): Get a string representing the current URL that the browser is looking at.Driver.getCurrentUrl();
getPageSource(): Get the source of the last loaded page.Driver.getPageSource();
getTitle(): The title of the current page.Driver.getTitle();
getWindowHandle(): Return an opaque handle to this window that uniquely identifies it within this driver instance.Driver.getWindowHandle();
getWindowHandles(): Return a set of window handles which can be used to iterate over all open windows of this webdriver instance by passing them to #switchTo().window(String)Driver.getWindowHandles();
manage() Gets the Option interface.Driver.manage()
navigate(): An abstraction allowing the driver to access the browser's history and to navigate to a given URL.Driver.navigate()
quit(): Quits this driver, closing every associated window.Driver.quit();
switchTo(): Send future commands to a different frame or window.Driver.switchTo()
Comments
Post a Comment