Selenium WebDriver Job Interview Questions Part - 9

Part 9

41 : What kind of software testings are possible using selenium WebDriver? We can use It for any other purpose except testing activity?
Answer : Generally we are using selenium WebDriver for functional and regression testing of software web applications.


42 : Give me any five different xPath syntax to locate bellow given Input element.
<input id="fk-top-search-box" class="search-bar-text fk-font-13 ac_input" type="text" autofocus="autofocus" value="" name="q" />
Answer : Five xPath syntax for above element of software web application page are as bellow.
//input[@id='fk-top-search-box']
//input[contains(@name,'q')]
//input[starts-with(@class, "search-bar-text")]
//input[@id='fk-top-search-box' or @name='q']
//input[starts-with(@id, 'fk-top-search-box') and contains(@class,'fk-font-13')]

See detailed tutorial on How To Locate XPath Of Element.

43 : Can you tell me two drawbacks of xPath locators as compared to cssSelector locator?
Answer : Two main disadvantage of xPath locator as compared to cssSelector locator are as bellow.
  • It Is slower than cssSelector locator.
  • xPath which works In one browser may not work In other browser for same page of software web application because some browsers (Ex. IE) reads only Lower-cased tag name and Attribute Name. So If used It In upper case then It will work In Firefox browser but will not work In IE browser. Every browser reads xPath In different way. In sort, do not use xPath locators In your test cases of software web application If you have to perform cross browser testing using selenium WebDriver software testing tool.
44 : Why xPath locator Is much more popular than all other locator types In WebDriver?
Answer : xPath locators are so much popular In selenium webdriver test case development because
  • It Is very easy to learn and understand for any new user.
  • There are many functions to build xPath In different ways like contains, starts-with etc.. So If one Is not possible you will have always another option to build xPath of any element.
  • Presently many tools and add-ons are available to find xpath of any element.
45 : Give me WebDriver's API name using which we can perform drag and drop operation.
Answer : That API's name Is Advanced User Interactions API using which we can perform drag and drop operation on page of software web application. Same API can help us to perform some other operations too like moveToElement, doubleClick, clickAndHold, moveToElement, etc..

View Example1 and Example2 for dragging and dropping element.



No comments:

Post a Comment