05. Selenium Interview Questions Part - 5

1. What are the different assertions in SIDE?
Assertions are like Assessors, but they verify that the state of the application conforms  to what is expected. Examples include "make sure the page title is X" and "verify that this  check box is checked".

2. How to store a value which is text box using  web driver?
driver.findElement(By.id("your Textbox")).sendKeys("your keyword");

3. How to handle alerts and confirmation boxes.
Confirmation boxes and Alerts are handled in same way in selenium.
var alert = driver.switchTo().alert();
alert.dismiss();  //Click Cancel or Close window operation
alert.accept();   //Click OK
Handle Confirmation boxes via JavaScript,
driver.executeScript("window.confirm = function(message){return true;};");

4. How to mouse hover on an element?
Actions action = new Actions(webdriver);
WebElement we = webdriver.findElement(By.xpath("html/body/div[13]/ul/li[4]/a"));
action.moveToElement(we).moveToElement(webdriver.findElement(By.xpath("/expression-here"))).click().build().perform();

5. How to switch between the windows?
private void handlingMultipleWindows(String windowTitle) {
            Set<String> windows = driver.getWindowHandles();
            for (String window : windows) {
                driver.switchTo().window(window);
                if (driver.getTitle().contains(windowTitle)) {   return;   }     }     }


6. How to switch between frames?

WebDriver's driver.switchTo().frame() method takes one of the three possible arguments:·         
      7. What is actions class in web driver?
Actions class with web Driver help is Sliding element, Resizing an Element, Drag & Drop,
hovering a mouse, especially in a case when dealing with mouse over menus.

8. Difference between the selenium1.0 and selenium 2.0?
Selenium 1 = Selenium Remote Control.
Selenium 2 = Selenium Web driver, which combines elements of Selenium 1 and Web driver.

9. Difference between find element () and  findelements ()?
findElement() :
Find the first element within the current page using the given "locating mechanism".
Returns a single WebElement.
findElements() :
Find all elements within the current page using the given "locating mechanism".
Returns List of Web Elements.

10. How to take the screen shots in seelnium2.0?

11. What is the default time for selenium Ide and webdriver?
Default timeout in selenium ide is 30 seconds.
For web driver go to below URL:
12. Write down scenarios which we can't automate?
Barcode Reader, Captcha etc.

13. In TestNG I have some test's  Test1-Test2-Test3-Test4-Test5I want to run my execution order is Test5-Test1-Test3-Test2-Test4.How do you set the execution order can you explain for that?
·         Use priority parameter in @test annotation or TestNG annotations.
14. Differences between jxl and ApachePOI.
·         jxl does not support  XLSX files
·         jxl exerts less load on memory as compared to ApachePOI
·         jxl doesn't support rich text formatting while ApachePOI does.
·         jxl has not been maintained properly while ApachePOI is more up to date.
·         Sample code on Apache POI is easily available as compare to jxl.

15. How to ZIP files in Selenium with an Example?

16. What is default port no?
4444

17. If Default port no is busy how to change port no?
We can use any port number which is valid.. First create an object to remote control configuration.
Use 'setPort' method and provide valid port number(4545,5555,5655, etc).. There after attach this
remote control configuration object to selenium server..i.e
RemoteControlConfiguration r= new RemoteControlConfiguration();
r.setPort(4567);
SeleniumServer s= new SeleniumServer(r);


18. Does Selenium support https protocols?  Yes
19. "I want to find the location of ""b"" in the below  code, how can I find out without using xpath, name, id, csslocator, index.<div><Button>a</button> <Button>b</button><Button>c</button></div>
    ?      driver.findElement(By.xpath("//*[contains(text(),'b')]")).click(); or
?        //div/button[contains(text(),'b']
·      
20. How to do Applet testing using selenium? 
Please see below URLs:

2 comments:

  1. This is very informative blog and article thank you for sharing with us keep posting more information about salesforce trainingselenium training, selenium online training, selenium course,learn selenium course

    ReplyDelete
  2. Very Nice...Contains A to Z concepts...Thanks a lot.. and looking for the best selenium training in Chennai with certification from us. we have experienced selenium experts offer selenium course training with industry exposure. Check Here https://goo.gl/VRNEXv

    ReplyDelete