Showing posts with label Selenium interview questions with answers. Show all posts
Showing posts with label Selenium interview questions with answers. Show all posts

What are the test types supported by Selenium?

Selenium supports UI and functional testing. As well it can support performance testing for reasonable load using selenium grid.

What mobile devices it may Support?

Selenium Web driver supports all the mobile devices operating on Android, IOS operating Systems
·         Android – for phones and tablets (devices & emulators)
·         iOS for phones (devices & emulators) and for tablets (devices & emulators)

How do you create html test report from your test script?

• I would see below 3 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.

How to store a value which is text box using web driver?

driver.findElement("your Textbox")).sendKeys("your keyword");

How to work with dynamic web table?

You can get the total number of <tr> tags within a <td> tag by giving the xpath of the <td> element by using  this function -
List<WebElement> ele = driver.findElements(By.xpath("Xpath of the table"));
Now you can use a for each loop to loop through each of the <tr> tags in the above list and then read each  value by using getText() method.

How to change user agent in Firefox by selenium web driver.

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("general.useragent.override", "some UA string");
Web Driver driver = new FirefoxDriver(profile);

How to disable cookies in browser.

·         Using deleteAllVisibleCookies() in selenium

What Class Extends Web Driver?

 ·   AndroidDriver, ChromeDriver, EventFiringWebDriver, FirefoxDriver, HtmlUnitDriver, InternetExplorerDriver, IPhoneDriver, PhantomJSDriver, RemoteWebDriver, SafariDriver

How to get text from captcha image?

String attr = ie.findElement(By.xpath(".//*[@id='SkipCaptcha']")).getAttribute("value");
System.out.println("The value of the attribute 'Name' is " + attr);

How to handle colors in web driver?

Use getCssValue(arg0) function to get the colors by sending 'color' string as an argument.
String col = driver.findElement("color");

How to handle Ajax popup window?

By using getWindowHandles() and obj.switchTo.window(windowid) we can handle popups using explicit wait and driver.swtchT0.window("name") commands for your requirements.

Is it possible test web services using selenium?

Using Jmeter we can test how one website is talking to each other means time taken to send data, feeds, messages from one website to other website. Jmeter does a nice job of doubling for performance and api tests.

How can we get the font size, font color, font type used for a particular text on a web page using Selenium web driver?

driver.findelement(By.Xpath("Xpath ").getcssvalue("font-size);
driver.findelement(By.Xpath("Xpath ").getcssvalue("font-colour);
driver.findelement(By.Xpath("Xpath ").getcssvalue("font-type);
driver.findelement(By.Xpath("Xpath ").getcssvalue("background-colour);

How to put text in Facebook search box using selenium web driver.

·         driver.findElement(By.xpath("//div[contains(@class, '_586i')]")).sendKeys("abc");

How to overcome same origin policy through web driver?

·         Proxy server.
DesiredCapabilities capability=new DesiredCapabilities.firefox();
capability.setCapability(CapabilityType.PROXY,"your desire proxy")
WebDriver driver=new FirefoxDriver(capability);

How to handle internationalisation through web driver?

FirefoxProfile profile = new FirefoxProfile();
profile.set Preference("intl.accept_languages","jp");
Web driver driver = new FirefoxDriver(profile); driver.get( will open google in Japanese Lang

What is the basic use of Firefox profiles and how can we use them using selenium?

A profile in Firefox is a collection of bookmarks, browser settings, extensions, passwords, and history; in short, all of your personal settings.
We use them to change user agent, changing default download directory, changing versions etc.

What is the difference between driver.Close() and driver.Quit () method?

Close() - It is used to close the browser or page currently which is having the focus.
Quit() - It is used to shut down the web driver instance or destroy the web driver instance

What is the difference between "GET" and "NAVIGATE" to open a web page in selenium web driver?

Get method will get a page to load or get page source or get text that's all whereas navigate  will guide through the history like refresh, back, forward.For example if we want to move forward and do some functionality and back to the home page this can be achieved through navigate() only. driver.get will wait  till the whole page gets loaded and driver.navigate will just redirect to that page and will not wait.

In what situation selenium finding element get fails?

·         Element loading issue
·         Dynamic id of web element