Part 21
98 : Do y'all know whatever external API cite using which nosotros tin post away read information from excel file?
Answer :
- We tin post away operate jxl API (Java Excel API) to read information from excel file. VIEW EXAMPLE
- We tin post away operate i to a greater extent than powerful API known as Apache POI API to read in addition to write information In excel file. I convey created information driven framework using Apache POI API. You can VIEW DATADRIVEN FRAMEWORK CREATION TUTORIALS step past times step.
Answer : WebDriver's unlike five exceptions are every bit bellow.
- TimeoutException - This exception volition last thrown when ascendency execution does non consummate In given time.
- NoSuchElementException - WebDriver software testing tool volition throw this exception when chemical ingredient could non last establish on page of software spider web application.
- NoAlertPresentException - This exception volition last generated when webdriver ties to switch to alarm popup but at that spot Is non whatever alarm introduce on page.
- ElementNotSelectableException - It volition last thrown when webdriver Is trying to guide unselectable element.
- ElementNotVisibleException - Thrown when webdriver Is non able to Interact amongst chemical ingredient which Is available In DOM but It Is hidden.
- StaleElementReferenceException - VIEW DESCRIPTION.
100 : Tell me unlike ways to type text In text box In selenium software test.
Answer : We tin post away type text In text box of software spider web application page using bellow given ways In selenium test.
1.Using .SendKeys() method
2. Using JavascriptExecutor
3. Using Java Robot shape VIEW EXAMPLE
1.Using .SendKeys() method
driver.findElement(By.xpath("//input[@id='fname']")).sendKeys("Using sendKeys");
2. Using JavascriptExecutor
((JavascriptExecutor)driver).executeScript("document.getElementById('fname').value='Using JavascriptExecutor'");
3. Using Java Robot shape VIEW EXAMPLE
driver.findElement(By.xpath("//input[@id='fname']")).click(); Robot robot = novel Robot(); robot.keyPress(KeyEvent.VK_U); robot.keyPress(KeyEvent.VK_S); robot.keyPress(KeyEvent.VK_I); robot.keyPress(KeyEvent.VK_N); robot.keyPress(KeyEvent.VK_G); robot.keyPress(KeyEvent.VK_SPACE); robot.keyPress(KeyEvent.VK_R); robot.keyPress(KeyEvent.VK_O); robot.keyPress(KeyEvent.VK_B); robot.keyPress(KeyEvent.VK_O); robot.keyPress(KeyEvent.VK_T);
101 : Tell me unlike ways to verify chemical ingredient introduce or non on page.
Answer : We tin post away cheque If chemical ingredient Is introduce or non on page of software nosotros application using bellow given ii uncomplicated ways.
1. Using .size() method
2. Using .isEmpty() method
1. Using .size() method
Boolean elePresent = driver.findElements( By.id("ID of element") ).size() != 0;
If inwards a higher house syntax provide "false" way chemical ingredient Is non introduce on page in addition to "true" way chemical ingredient Is introduce on page.2. Using .isEmpty() method
Boolean elePresent = driver.findElements(By.id("ID of element")).isEmpty();
If this returns "true" way chemical ingredient Is non introduce on page in addition to "false" way chemical ingredient Is introduce on page.
102 : Why nosotros bespeak to customize Firefox browser profile In webdriver test?
Answer : Webdriver launch fresh browser Instance when nosotros run software tests In Firefox browser using selenium webdriver. Fresh browser Instance practise non convey whatever Installed add-ons, saved passwords, bookmarks in addition to whatever other user preferences. So nosotros bespeak to practise custom profile of Firefox browser to larn whatever of this affair In Webdriver launched browser. VIEW MORE DETAIL WITH EXAMPLE