Selenium - WebDriver

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What Is Parallelism In TestNG? The usages and syntax?

"- We can start multiple threads at once - Test methods wil be executed in them. - The execution test wil be reduced. <suite name=""Parallel Class Suite"" parallel=""classes"" thread-count=""2""> "

What Is XPath and what Is use of It In WebDriver?

"- XPath is used to locate the elements. - Using XPath, We can to locate elements like buttons, text box, links, Images... to have action on them. "

Is It possible to execute javascript directly during software test execution? If Yes then tell me how to generate alert by executing javascript In webdriver script?

"- Yes, we can execute javascript during webdriver software test execution. - To generate alert: JavascriptExecutor javascript = (JavascriptExecutor) driver; javascript.executeScript(""alert('Javascript Executed.');""); "

Tell me any 5 assertions of TestNG.

"- assertEquals - assertNotEquals - assertTrue - assertFalse - assertNull - assertNotNull "

What Is TestNG?

"- TestNG is an open source testing framework. - It inspried from NUnit and JUnit with new powerful features. - Can configure and run test cases, easy to understand, to generate HTML report. "

What is the difference between "/" and "//" in Xpath?

"/ : absolute xpath // : relative xpath "

How to pass parameter with testng.xml file to use It In test case?

"<parameter name=""browser"" value=""FFX"" /> ... @Parameters ({""browser""}) "

How to set priority of @Test method?

"@Test(priority=0) "

What are the benefits of automation testing?

"- Fast Test Execution (manual is time comsuming) - Re-usability Of Test Cases (prepare one time and run many time) - Testing Cost Reduction (Reduce human efford) - Better Test Coverage In Each Version Release (can execute all release) - Easy For Compatibility Testing (easy to run same test on different environtment) "

What are the different types of Drivers available in WebDriver? Which supports Mobile Driver?

"- FirefoxDriver - InternetExplorerDriver - ChromeDriver - SafariDriver - HtmlUnitDriver Mobile: - AndroidDriver - OperaMobileDriver - IPhoneDriver "

How many types of waits available? What are they?

"- Implicit Wait (wait ngầm, maximum), đợi maximum 10s, có thể nhanh hơn. driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); - Explicit Wait (wait rõ ràng, cố định), đợi hết 20s mới action tiếp. WebDriverWait wait = new WebDriverWait(driver, 20); wait.until(ExpectedConditions.elementToBeClickable(By...)); "

I have used findElements In my software test case. It Is returning NoSuchElementException when not element found. Correct me If I am wrong.

"- It Is Incorrect. - findElements will never return NoSuchElementException. It will return just an empty list."

What Is JUnit?

"- JUnit is a testing framework to write repeatable tests for java programming language. - simple and open source - use to manage test script for WebDriver. "

Can you describe major features of TestNG?

"- Many new annotation likes @DataProvider - Execute test cases dependency - Group test cases - Generate interactive reports... "

My Firefox browser Is not Installed at usual place. How can I tell FirefoxDriver to use It?

"- Needs to provide the actual path of Firefox.exe: System.setProperty(""webdriver.firefox.bin"",""C:\\Program Files\\Mozilla Firefox\\Firefox.exe""); driver = new FirefoxDriver(); "

What is Advantages of Selenium?

"- Open source - Big - strong supporting community - Support many programing languages - Can run on many OS - Test case can run in background - Can use third-party app: AutoIt or Coded UI. "

How does selenium RC / WebDriver drive the browser?

"- Selenium RC: apply javascript functions into the browser. - WebDriver: use browser's native support to make direct calls as real user behaviors. "

I wants to set size and position of my browser window.

"- Size: driver.manage().window().setSize(new Dimension(300,500)); - Position: driver.manage().window().setPosition(new Point(50,200)); "

What are the advantages of TestNG over JUnit.

"- TestNG Annotations are simple and Easy to understand. - Easy to use parameter in test cases. - Easy to run test cases In parallel. - Can generate Interactive reports. "

Tell me any 5 webdriver common exceptions which you faced during software test case execution.

"- TimeoutException - NoSuchElementException - NoAlertPresentException - ElementNotSelectableException - ElementNotVisibleException - StaleElementReferenceException "

What Is Ajax?

"- Asynchronous JavaScript and XML - Is used for creating dynamic web pages very fast - update data Without reloading page "

"How To Handle Dynamic Changing IDs In XPath. Example : //div[@id='post-body-3647323225296998740']/div[1]/form[1]/input[1]"

"There are many different ways for this case. Way 1: If the first div has other attribute, we can use instead of ID, like name, class, tagName... //div[@class='post-body entry-content']/div[1]/form[1]/input[1] Way 2: Use absolute Xpath without giving attributes. /html/body/div[3]/div/div/div/div[1]/div[2]/div[1]/form[1]/input[1] Way 3: Use starts-with function //div[starts-with(@id,'post-body-')]/div[1]/form[1]/input[1] Way 4: Use contains function div[contains(@id,'post-body-')]/div[1]/form[1]/input[1] "

I wants to pass parameter In software test case through testng.xml file. How can I do It?

"You can use <parameter> node under <test> node In testng.xml file "

What Is the syntax to set test method disabled.

@Test(enabled = false) ...

Which tool you are using to find the XPath of any element?

Firefox AddOn: FireBug and FirePath

What type of testing do we can use Selenium?

For functional and regression test.

Which Different Element Locators Supported By Selenium WebDriver? / How will you find an element using Selenium?

ID Name Classname Tag Attribute CSS Linktext PartialLink Text Xpath

How can I pause my test 10s at a special point?

Thread.sleep(10000);

For what purpose, assertTrue and assertFalse assertions are used?

We need to assert Boolean conditions true and false.

Can you tell me the syntax to open/launch Firefox browser?

WebDriver driver = new FirefoxDriver();

I have total 200 test cases. I wants to execute only 20 test cases out of them. Can I do It In selenium WebDriver? How?

Yes. You can use TestNG to group this 20 test cases in testng.xml file and execute that group.

Is there any other way using which I can upload file In selenium test?

You can use AutoIT V3

Tell me looks like CSSSelector path of sibling Input element which Is after Div in the DOM.

css=div + input

On Google search page, I wants to search for some words without clicking on Google Search button. Is It possible In WebDriver? How?

driver.findElement(By.xpath("//input[@id='gbqfq']")).sendKeys("Search Syntax",Keys.ENTER);

Which Is the latest version of Selenium.

selenium 3.8.1

"Tell me a scenario which we can not automate In selenium WebDriver. What are the limitations of Selenium?"

"- Bitmap comparison - Read captcha / bar code - Test desktop application - Use third party tools like TestNG or JUnit to do Report. "

Can you tell me a syntax to close current webdriver Instance and to close all opened webdriver Instances?

"- Current instance: driver.close(); - All instances: driver.quit(); "

When we can use Actions class In Selenium WebDriver test case?

"- Drag and drop element - Drag and drop by x,y pixel offset - Selecting JQuery selectable Items - Moving JQuery slider - Re-sizing JQuery re-sizable element - Selecting date from JQuery date picker "

Why xPath locator Is much more popular than all other locator types In WebDriver?

"- Easy to learn and use - Many way to use: contains, starts-with... can flexible - Many tool and add-on support to find xpath."

How to handle Ajax In selenium WebDriver?

"- Generally we are using Implicit wait... "

What is the difference between absolute XPath and relative XPath?

"- Absolute XPath Is the full path starting from root node to ends element's node. Stating with forward slash(/) /html/body/div[3]/div[2]/div[2]/div[2]/form/table/tbody/tr[1]/td/input - Relative XPath is a shorter path starts from any In between node or current element's node. Stating with double forward slash(//) //input[@id='Resultbox'] "

What Is dependency test In TestNG? And the syntax?

"- Allow a test method can depend on other method, it means running after that methods've done. @Test(dependsOnMethods={""Login"",""checkMail""}) public void LogOut() { ... } "

Which OpenSource Framework Is Supported In WebDriver With Java?

"- JUnit - TestNG "

Can you tell me the usage of "submit" method In selenium WebDriver?

"- We can use submit method in the form, such as: registration form, LogIn, Contact Us... after filling required fields. "

Which Operating systems support Selenium WebDriver?

"- Windows - Windows XP, Windows 7, Windows 8 and Windows 8.1 - Apple OS X - Linux - Ubuntu. "

What Is the difference between findelement and findElements ?

"- findElement: locate and return single element - findElements: locate and return multiple elements (a list of elements) "

In selenium IDE what are the element locators that can be used to locate elements on web page?

* X-path locators * Css locators * Html id * Html name

What are the four parameter you have to pass in Selenium?

- Host - Port Number - Browser - URL

Can we use Selenium grid for performance testing?

Can we use Selenium grid for performance testing?

Explain how you can use recovery scenario with Selenium?

Recovery scenarios depends upon the programming language you use. If you are using Java then you can use exception handling to overcome same. By using "Try Catch Block" within your Selenium WebDriver Java tests

How can you prepare customized html report using TestNG in hybrid framework ?

There are three ways * Junit: With the help of ANT * TestNG: Using inbuilt default.html to get the HTML report. Also XST reports from ANT, Selenium, TestNG combinations * Using our own customized reports using XSL jar for converting XML content to HTML

Explain how you can capture server side log Selenium Server?

To capture server side log in Selenium Server, you can use command java -jar .jar -log selenium.log

To generate pdf reports mention what Java API is required?

To generate pdf reports mention what Java API is required?

Can you tell me the names of different projects of selenium software automation testing tool?

"- Selenium IDE - Selenium RC - Selenium WebDriver - Selenium Grid "

Do you know any external API name using which we can read data from excel file?

"- We can use external library jxl API - Another API is Apache POI API "

Tell me different ways to verify element present or not on page.

"1. Size method: .size() != 0 2. isEmpty method: .isEmpty() . isDisplayed() . isSelected() . isEnabled() - return True or false "

Can you tell me the alternative driver.get() method to open URL In browser?

"1. driver.get() 2. driver.navigate().to() "

Tell me different ways to type text In text box In selenium software test.

"1. sendKeys 2. Javascript Executor 3. Java Robot Class "

How to create and run JUnit test suite for selenium WebDriver?

"@RunWith(Suite.class) @SuiteClasses({ junittest1.class, junittest2.class }) public class junittestsuite { . . . } "

Tell me different JUnit annotations and Its usage.

"@Test (identify test methods) @Before (each) @After (each) @BeforeClass (First) @AfterClass (Last) @Ignore (exlcude) @Test(timeout=1000) "

"Arrange bellow given drivers In fastest to slowest sequence? Firefox Driver, HtmlUnit Driver, Internet Explorer Driver. "

"HtmlUnit Driver, Firefox Driver, Internet Explorer Driver"

How to retrieve css properties of an element?

"Run script on multiple flatforms and browsers, different environments. "

Explain what are the limitations of Selenium IDE?

- Exceptional handling is not present - Selenium IDE uses only HTML languages - External databases reading is not possible with IDE - Reading from the external files like .txt, .xls is not possible - Conditional or branching statements execution like if,else, select statements is not possible

Explain in Selenium IDE how can you debug the tests?

- Insert a break point from the location from where you want to execute test step by step - Run the test case - At the given break point execution will be paused - To continue with the next statement click on the blue button - Click on the "Run" button to continue executing all the commands at a time

List out the technical challenges with Selenium?

- Selenium supports only web based applications - It does not support the Bitmap comparison - For any reporting related capabilities have to depend on third party tools - No vendor support for tool compared to commercial tools like HP UFT - As there is no object repository concept in Selenium, maintainability of objects becomes difficult

Mention in what ways you can customize TestNG report?

- Using ITestListener Interface - Using IReporter Interface

What is Object Repository ?

An object repository is an essential entity in any UI automations which allows a tester to store all object that will be used in the scripts in one or more centralized locations rather than scattered all over the test scripts.

Explain what is assertion in Selenium and what are the types of assertion?

Assertion is used as a verification point. It verifies that the state of the application conforms to what is expected. The types of assertion are "assert" , "verify" and "waifFor".

What is the difference between setSpeed() and sleep() methods?

Both will delay the speed of execution. Thread.sleep () : It will stop the current (java) thread for the specified period of time. Its done only once * It takes a single argument in integer format Ex: thread.sleep(2000)- It will wait for 2 seconds * It waits only once at the command given at sleep SetSpeed () : For specific amount of time it will stop the execution for every selenium command. * It takes a single argument in integer format Ex: selenium.setSpeed("2000")- * It will wait for 2 seconds Runs each command after setSpeed delay by the number of milliseconds mentioned in set Speed This command is useful for demonstration purpose or if you are using a slow web application.

Explain what is Datadriven framework and Keyword driven?

Datadriven framework: In this framework, the test data is separated and kept outside the Test Scripts, while test case logic resides in Test Scripts. Test data is read from the external files ( Excel Files) and are loaded into the variables inside the Test Script. Variables are used for both for input values and for verification values. Keyworddriven framework: The keyword driven frameworks requires the development of data tables and keywords, independent of the test automation. In a keyword driven test, the functionality of the application under test is documented in a table as well as step by step instructions for each test.

Mention why to choose Python over Java in Selenium?

Few points that favor Python over Java to use with Selenium is, - Java programs tend to run slower compared to Python programs. - Java uses traditional braces to start and ends blocks, while Python uses indentation. - Java employs static typing, while Python is dynamically typed. - Python is simpler and more compact compared to Java.

List out the test types that are supported by Selenium?

For web based application testing selenium can be used The test types can be supported are a) Functional b) Regression For post release validation with continuous integration automation tool could be used a) Jenkins b) Hudson c) Quick Build d) CruiseCont

Which web driver implementation is fastest?

HTMLUnit Driver implementation is fastest, HTMLUnitDriver does not execute tests on browser but plain http request, which is far quick than launching a browser and executing tests

Why to use TestNG with Selenium RC ?

If you want full automation against different server and client platforms, You need a way to invoke the tests from a command line process, reports that tells you what happened and flexibility in how you create your test suites. TestNG gives that flexibility.

Mention what is the difference between Implicit wait and Explicit wait?

Implicit Wait: Sets a timeout for all successive Web Element searches. For the specified amount of time it will try looking for element again and again before throwing a NoSuchElementException. It waits for elements to show up. Explicit Wait : It is a one-timer, used for a particular search.

Mention what is Listeners in Selenium WebDriver?

In Selenium WebDriver, Listeners "listen" to the event defined in the selenium script and behave accordingly. It allows customizing TestNG reports or logs. There are two main listeners i.e. WebDriver Listeners and TestNG Listeners.

Mention what is IntelliJ?

Intellij is an IDE that helps you to write better and faster code for Selenium. Intellij can be used in the option to Java bean and Eclipse.

Selenium WebDriver has any built In method using which we can read data from excel file?

No. Selenium WebDriver do not have any.

Explain how you can login into any site if it's showing any authentication popup for password and username?

Pass the username and password with url * Syntax-http://username:password@url * ex- http://creyate:[email protected]

Mention what is Selenium 3.0?

Selenium 3.0 is the latest version of Selenium. It has released 2 beta versions of selenium 3.0 with few of the below changes: Here are few new features added to Selenium 3.0 Beta 1 updates: - Minimum java version is now 8+ - It will support for Firefox Via Mozilla's geckodriver - Support for Edge is provided by MS - It now supports Safari on MacOS via Apple's own Safari driver Beta 2 updates (Only for Java) - System property webdriver.firefox.marionette now forces the server in marionette or legacy firefox driver mode, ignoring any related Desired Capability - Grid fixes NPE's on registration when -browser not specified - Update GeckoDriver -port argument in all bindings

Explain how Selenium Grid works?

Selenium Grid sent the tests to the hub. These tests are redirected to Selenium Webdriver, which launch the browser and run the test. With entire test suite, it allows for running tests in parallel.

Why Selenium RC is used?

Selenium IDE does not directly support many functions like condition statements, Iteration, logging and reporting of test results, unexpected error handling and so on as IDE supports only HTML language. To handle such issues Selenium RC is used it supports the language like Perl, Ruby, Python, PHP using these languages we can write the program to achieve the IDE issues.

What is selenium RC (Remote Control)?

Selenium IDE have limitations in terms of browser support and language support. By using Selenium RC limitation can be diminished. - On different platforms and different web browser for automating web application selenium- O RC is used with languages like Java, C#, Perl, Pyth- Oon - Selenium RC is a java based and using any language it can interact with the web applicatio- n- - Using server you can bypass the restriction and run your automation script running against- any web application-

What is Selenium and what is composed of?

Selenium is a suite of tools for automated web testing. It is composed of * Selenium IDE (Integrated Development Environment) : It is a tool for recording and playing back. It is a firefox plugin * WebDriver and RC: It provide the APIs for a variety of languages like Java, .NET, PHP, etc. With most of the browsers Webdriver and RC works. *Grid: With the help of Grid you can distribute tests on multiple machines so that test can be run parallel which helps in cutting down the time required for running in browser test suites

Mention when to use AutoIT?

Selenium is designed to automate web-based applications on different browsers. But to handle window GUI and non-HTML popups in the application you need AutoIT.

What is same origin policy? How you can avoid same origin policy?

The "Same Origin Policy" is introduced for security reason, and it ensures that content of your site will never be accessible by a script from another site. As per the policy, any code loaded within the browser can only operate within that website's domain. To avoid "Same Origin Policy" proxy injection method is used, in proxy injection mode the Selenium Server acts as a client configured HTTP proxy , which sits between the browser and application under test and then masks the AUT under a fictional URL

Mention what are the advantages of Using Git Hub For Selenium?

The advantages of Using Git Hub for Selenium are: - Multiple people when they work on the same project they can update project details and inform other team members simultaneously. - Jenkins can help you to build the project from the remote repository regularly. This helps you to keep track of failed builds.

Mention what are the challenges in Handling Ajax Call in Selenium Webdriver?

The challenges faced in Handling Ajax Call in Selenium Webdriver are: - Using "pause" command for handling Ajax call is not completely reliable. Long pause time makes the test unacceptably slow and increases the testing time. Instead, "waitforcondition" will be more helpful in testing Ajax applications. - It is difficult to assess the risk associated with particular Ajax applications - Given full freedom to developers to modify Ajax application makes the testing process challenging - Creating automated test request may be difficult for testing tools as such AJAX application often use different encoding or serialization technique to submit POST data.

What is heightened privileges browsers?

The purpose of heightened privileges is similar to Proxy Injection, allows websites to do something that are not commonly permitted. The key difference is that the browsers are launced in a special mode called heightened privileges. By using these browser mode, Selenium core can open the AUT directly and also read/write its content without passing the whole AUT through the Selenium RC server.

Explain how you can find broken images in a page using Selenium Web driver ?

To find the broken images in a page using Selenium web driver is * Get Xpath and get all the links in the page using tag name * In the page click on each and every link * Look for 404/500 in the target page title

Explain how you can handle colors in web driver?

To handle colors in web driver you can use Use getCssValue(arg0) function to get the colors by sending 'color' string as an argument

Using Selenium how can you handle network latency ?

To handle network latency you can use driver.manage.pageloadingtime for network latency

Explain how you can switch back from a frame?

To switch back from a frame use method defaultContent() Syntax-driver.switchTo().defaultContent();

Explain how you can switch between frames?

To switch between frames webdrivers [ driver.switchTo().frame() ] method takes one of the three possible arguments

What is the difference between type keys and type commands ?

TypeKeys() will trigger JavaScript event in most of the cases whereas .type() won't. Type key populates the value attribute using JavaScript whereas .typekeys() emulates like actual user typing

How will you handle working with multiple windows in Selenium ?

We can use the command selectWindow to switch between windows. This command uses the title of Windows to identify which window to switch to.

Is WebElement an interface or a class ?

WebDriver is an Interface.

What is regular expressions? How you can use regular expressions in Selenium ?

What is regular expressions? How you can use regular expressions in Selenium ?

Explain using Webdriver how you can perform double click ?

You can perform double click by using Syntax- Actions act = new Actions (driver); act.doubleClick(webelement);

Other than the default port 4444 how you can run Selenium Server?

You can run Selenium server on java-jar selenium-server.jar-port other than its default port

How will you use Selenium to upload a file ?

You can use "type"command to type in a file input box of upload file. Then, you have to use "Robot" class in JAVA to make file upload work.

How can you retrive the message in an alert box ?

You can use the storeAlert command which will fetch the message of the alert pop up and store it in a variable.

How will you verify the specific position of an web element

You can use verifyElementPositionLeft & verifyElementPositionTop. It does a pixel comparison of the position of the element from the Left and Top of page respectively

Can you tell me syntax to set browser window size to 800(Width) X 600(Height)?

driver.manage().window().setSize(new Dimension(800,600));

What Is the syntax to type value In prompt dialog box's Input field using selenium WebDriver

driver.switchTo().alert().sendKeys("Kita");

What is the difference between getWindowhandles() and getwindowhandle() ?

getwindowhandles(): It is used to get the address of all the open browser and its return type is iterator<String> getwindowhandle(): It is used to get the address of the current browser where the control is and return type is string

In Selenium IDE how you can generate random numbers and dates for test data ?

type element --- javascript{Math.random()} javascript{new Date()}

Can you tell me how to get latest version of WebDriver?

- Official website: http://docs.seleniumhq.org 3.8.0

How to write regular expression In testng.xml file to search @Test methods containing "product" keyword.

"<methods> <include name="".*product.*""/> </methods> "

Can you tell me usage of TestNG Soft Assertion?

"- We can continue our test execution even if assertion fails. - remaining part of @Test method will be executed - Failure will be reported at the end of @Test method. "

I wants to scroll my software web application page by 600 pixel. Tell me how can i do it?

"- You can use javascript executor. javascript.executeScript(""window.scrollBy(0,600)"", """"); "

In XPath, I wants to do partial match on attribute value from beginning. Tell me two functions using which I can do It.

"- contains() - starts-with() "

Can you tell me a difference between driver.get() and driver.navigate() methods?

"- driver.get() . generally used for Open URL of web application. . will wait till the whole page gets loaded. - driver.navigate() . generally used for navigate to URL, navigate back, navigate forward, refresh the page. . just navigate to the page, not wait till the whole page gets loaded. "

What is Difference between getAttribute() and getText()?

"- getText(): read text from element or alert - getAttribute(): read attribute value like ID, class, name, type... "

What do you know about Selenium?

"- open source automation test tool - the most powerful to test web application - Selenium script run almost browsers and OS - Selenium IDE: Record/Playback as a add-on Firefox. - Selenium Gird: run on many browser at once - WebDriver / Selenium RC: write scripts in many programing languages (Java, C#, Python, Ruby...) "

Tell me looks like XPath of sibling Input element which Is after Div in the DOM.

"//div/following-sibling::input "

"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"" />"

"//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')]"

Describe the similarities and difference between JUnit and TestNG unit testing frameworks.

"1. Create test suite 2. Timeout test 3. Ignore test case 4. Create expected exception 5. Some same annotations. "

How to Install TestNG In Eclipse? How do you verify that TestNg Is Installed properly In Eclipse?

"1. Install: Help -> Install New Software -> input URL -> Next... 2. Check: Window -> Show View -> Others -> TestNG "

What are the prerequisites to run selenium webdriver?

"1. JDK 2. Eclipse 3. WebDriver jar 4. Browser 5. Application "

Can you tell me three different ways to refresh page. Do not use .refresh() method.

"1. driver.get(driver.getCurrentUrl()); 2. driver.navigate().to(driver.getCurrentUrl()); 3. driver.findElement(By.xpath(""//h1[@class='title']"")).sendKeys(Keys.F5); "

Which Is the latest version of JUnit.

"4.12 This can change In future. Can check at http://junit.org/junit4/"

"Arrange bellow give testng.xml tags from parent to child. <test> <suite> <class> <methods> <classes> "

"<suite> <test> <classes> <class> <methods>"

What are different annotations supported by TestNG ?

"@Test @BeforeMethod @AfterMethod @BeforeClass @AfterClass @BeforeTest @AfterTest @BeforeSuite @AfterSuite @DataProvider @BeforeGroups @AfterGroups @Parameters @Factory @Listeners "

Write sample JUnit @Test method that passes when expected ArithmeticException thrown.

"@Test(expected = ArithmeticException.class) public void excOnDivision() { int i = 5/0; } "

Do you need Selenium Server to run your tests In selenium WebDriver?

"It depends. - If we only use WebDriver to run all tests on same machine, we don't need selenium server. B/c Webdriver can interact directly with browser. - If we use remote or vitual machine to run test, browser versions will be differents, so we need a Selenium Server. "

Which Programming Languages Supported By Selenium WebDriver?

"Java C# PHP Python Ruby Perl "

Can we automate desktop software application's testing using selenium WebDriver?

"No. This Is the biggest disadvantage of selenium WebDriver. We can automate testing for only web application. That application can run on mobile browsers. "

"Bellow given syntax will work to navigate to specified URL In WebDriver? Why? driver.get(""www.google.com"");"

"No. It will throw exception. We need to provide http:// protocol: driver.get(""http://www.google.com"");"

When should I use Selenium Grid?

"Run script on multiple flatforms and browsers, different environments. "

What is Selenese?

"Selenese is the language which is used to write test scripts in Selenium IDE. "

What Is the syntax to get value from text box and store It In variable.

"String Result = driver.findElement(By.xpath(""//input[@id='Resultbox']""))\ .getAttribute(""value""); "

Give me a syntax to read alert message string, clicking on OK button and clicking on Cancel button.

"String alrtmsg = driver.switchTo().alert().getText(); driver.switchTo().alert().accept(); driver.switchTo().alert().dismiss(); "

Can you tell me two drawbacks of xPath locators as compared to cssSelector locator?

"Two main disadvantage of xPath locator: - It Is slower than cssSelector locator. - Should not use Xpath when performing cross browser testng. B/c: Every browser reads xPath In different way. "

Tell me the class name using which we can generate Action chain.

"We can generate actions chain (many actions at once) by ""Actions"" new Actions(driver).dragAndDrop(dragElementFrom, dropElementTo).build().perform(); "

What Is the usage of testng.xml file?

"We use testng.xml file to configure our whole test suite In one file. . Define testsuite, include & exclude testcases . Group testcases, use parameter, dependency, listeners . Create parallel test. "

"Tell me a reason behind this exception and how will you resolve It? ""Exception in thread ""main"" org.openqa.selenium.NoSuchElementException: Unable to locate element"""

"WebDriver Is not able to locate element on the page. - Check locator of that elements is correct or not. - If wrong, we mofify it. If correct, we need apply implicit wait for it in case it takes time to appear. - Another reason is dynamic ID. - One more reason is the implicit wait is not correct time. "

Tell Me WebDriver Supported Browsers?

"WebDriver has many different drivers to test web application in different browsers. - Firefox - Chrome - Internet Explorer - HtmlUnit - GUI-Less(Headless) browser for Java programs - Opera - Safari "

Can we capture screenshot In Selenium WebDriver software testing tool? How?

"Yes, we can. And can save it into local drive. File screenshot = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot, new File(""D:\\screenshot.jpg"")); "

What are different assertions supported by JUnit?

"assertEquals assertFalse assertTrue assertNull assertNotNull assertSame assertNotSame assertArrayEquals "

How to press ENTER key button on text box?

"driver.findElement(...).sendKeys(Keys.ENTER); "

Can you give me example of JUnit assertEquals assertion?

"public void sumExample() { int val1 = 10; int val2 = 20; int expTotal = 35; int actTotal = 0; actTotal = val1 + val2; assertEquals(actTotal, expTotal); } "

What versions of Internet Explorer are supported by selenium WebDriver software testing tool?

IE 6, 7, 8, 9, 10 and 11 with appropriate combinations of Windows 7, Vista or XP.

Does Selenium WebDriver Support Record And Playback?

No. WebDriver doesn't have, but we can record and playback with Selenium IDE.

Can we perform drag and drop operation In Selenium WebDriver?

new Actions(driver).dragAndDrop(elementX, elementY).build().perform();

Tell me syntax to skip @Test method from execution.

throw new SkipException("Test Check_Checkbox Is Skipped");


Ensembles d'études connexes

O.Chem Carey 10th: Ch.3 Conformations

View Set

Final Knowledge Check Cellular Regulation

View Set