Selenium Interview Question and answer.

Q. How to handle parent-child web locator of web page.
Ans.
Q. How to verify data of dynamic web table.
Ans. There are two types of HTML tables published on the web.
Static: Data is static i.e. Number of rows and columns are fixed
1. Find table say T
2. Find row say R using T.row[n]
3. Then find column say C of that row like R.col[n]
4. C.getText()

Dynamic:Data is dynamic i.e. Number of rows and columns are NOT fixed.
Q. How to handle java script Alert and popup.
Ans.
Q. What is exception and explain some most common used exceptions.
Ans.
Q. What is difference between elementNotFound and elementNotVisisble exception.
Ans.
Q. How to call external executable file in your selenium script.
Ans.
Q. How to handle windows dialog using selenium webdriver.
Ans.
Q. What is implicit and explicit wait in selenium.
Ans.
Q. How to handle multiple browser’s windows in selenium.
Ans.
Q. How to handle frames in selenium.
Ans.
Q. How to get and set text in Textarea element.
Ans.
Q. How to handle(select/deselect) drop down list using selenium.
Ans.
Q. How to handle multi select drop down list.
Ans.
Q. Difference between driver.quit() and driver.close().
Ans.
Q. Describe about ngWebDriver.
Ans. ngWebDriver – This is a way to automate angular based apps in selenium using java.
As we know we can use selenium webdriver and java to test angular js controls, but there are few limitations we need to stick to one locator strategy as selenium itself do not have locators method specific to handle angular controls like ngbinding, ngrepeater etc…), and sometime angular element’s actions lag behind the selenium line by line execution.
To overcome above issues angular js controls with selenium and java, a library known as ngWebDriver came out to add features to selenium and can write the scripts in java
ngwebdriver basically taken the advantage of other language like protractor and passing the javascript to browser to handle angular controls and also allows to write scripts in java language without any synchronization issue.

Let’s list our few angular controls that are different than normal html elements
ng-model
ng-repeat
ng-binding

If you observe, we can not use these controls value directly using selenium webdriver and java like id, tagname, link etc..

but ngwebdriver has capability to identify the above elements directly, let’s see
byAngular.binding(Str)
byAngular.model(str)
byAngular.options(str)
byAngular.repeater(str) – Angular web table

For setup simply add ngwebdriver-x.x.jar file to your existing selenium project and write below code.
You can download jar file from http://search.maven.org/#search%7Cga%7C1%7Cngwebdriver

public class NGDriverTest {
private static NgWebDriver ngDriver;
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "d:\\test\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://bimlesh.ultimate.com");
ngDriver = new NgWebDriver((JavascriptExecutor) driver);
ngDriver.waitForAngularRequestsToFinish();
driver.findElement(ByAngular.model("one")).sendKeys("1");
driver.findElement(ByAngular.model("two")).sendKeys("2");
//driver.findElement(By.id("forward")).click();
driver.findElement(ByAngular.buttonText("back!")).click();
}
}

Q. What type all type of options are available headers parts of http requests.
Ans.

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: