Selenium Interview Questions and Answers - Page 3

    0 Votes

23. Explain in detail different 'Wait' operations in Selenium Webdriver

There are two wait types available in Selenium Webdriver - Implicit Wait and Explicit Wait
Implicit Wait
An implicit wait is to tell Webdriver to provide a default waiting time when trying to find an element or elements if they are not immediately available. The default wait time is 0. For Example,
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
WebElement myDynamicElement = driver.findElement("myDynamicElement"));
Explicit Wait
Used to halt the execution till the time a particular condition is met. Unlike Implicit waits, Explicit waits are applied for a particular instance only. For example,
WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement element = wait.until(ExpectedConditions.elementToBeClickable("someid")));


24. What are the differences between findElement() and findElements() ?
  • findElement() : It finds the first element within the current page using the given locating mechanism. It returns a single WebElement.
  • findElements() : Using the given locating mechanism, find all the elements within the current page. It returns a list of web elements.


25. What is the Command to enter string into textbox using Selenium Webdriver



WebDriver driver = new FirefoxDriver();
WebElement searchName=driver.findElement("gs_htif0"));

26. How to switch between frames in Webdriver?

Select frame by Index :

driver.switchTo().frame(int arg0);

Select frame by Name or ID :

driver.switchTo().frame(String arg0);

Select frame by WebElement :

driver.switchTo().frame(WebElement frameElement);

27. How handle pop up in web application using Selenium Webdriver?

Alert alert = driver.switchTo().alert();

To cancel the message :


To accept the message :


To get string from alert message :

String msg = alert.getText();

To send string to alert box :


28. Can Selenium Webdriver handle windows pop up?

No, but a simple program called AutoIT can generate .exe file to be called in webdriver script.

29. Write AutoIT script to upload a file

Wait 10 seconds for the Upload window to appear


Set input focus to the edit control of Upload window using the handle returned by WinWait

ControlFocus("File Upload","","Edit1")

Set the File name text on the Edit field

ControlSetText("File Upload", "", "Edit1", "Complete file path")

Click on the Open button

ControlClick("File Upload", "","Button1");
Page 3 of 4

Popular Videos


How to improve your Interview, Salary Negotiation, Communication & Presentation Skills.

Got a tip or Question?
Let us know

Related Articles

Software Testing Interview Questions and Answers
Automation Testing Interview Questions and Answers