Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Automation puzzlers

1,131 views

Published on

QA Fest 2017

Published in: Software
  • Hello! Get Your Professional Job-Winning Resume Here - Check our website! https://vk.cc/818RFv
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Automation puzzlers

  1. 1. Test Automation Puzzlers
  2. 2. WAT?
  3. 3. Ciklum https://www.facebook.com/yaroslav.pernerovsky Sergey Pirogov Yaroslav Pernerovsky https://www.facebook.com/spirogov GlobalLogic
  4. 4. driver.get("google.com"); What will selenium do? A: Open google.com B: Sent GET request C: NullPointerException D: WebDriverException
  5. 5. org.openqa.selenium.WebDriverException: unknown error: unhandled inspector error: {"code":-32000, "message":"Cannot navigate to invalid URL"} (Session info: chrome=60.0.3112.113) (Driver info: chromedriver=2.32.498550 (9dec58e66c31bcc53a9ce3c7226f0c1c5810906a),platfo rm=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 0 milliseconds ...
  6. 6. People says that Selenide is better
  7. 7. What will selenide do? A: Open google.com B: Wait four seconds C: NullPointerException D: WebDriverException selenide.open("google.com");
  8. 8. Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: unhandled inspector error: {"code":-32000,"message":"Cannot navigate to invalid URL"} (Session info: chrome=61.0.3163.91) (Driver info: chromedriver=2.32.498513 (2c63aa53b2c658de596ed550eb5267ec5967b351),platform=Linux 4.10.0- 35-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 14 milliseconds Build info: version: '3.4.0', revision: 'unknown', time: 'unknown' System info: host: 'sergey-asus', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.10.0-35-generic', java.version: '1.8.0_144' Driver info: org.openqa.selenium.chrome.ChromeDriver selenide.url: http://localhost:8080google.com
  9. 9. What will happen? A: Set value to 1 B: NoSuchOptionException C: NullPointerException D: InvalidElementStateException <select id=”listBox”> <option value=’2’>1</option> </select> $("#listBox").setValue("1");
  10. 10. Exception in thread "main" org.openqa.selenium.InvalidElementStateException: invalid element state: Element must be user-editable in order to clear it. (Session info: chrome=60.0.3112.113) (Driver info: chromedriver=2.32.498537 (cb2f855cbc7b82e20387eaf9a43f6b99b6105061),platform=Mac OS X 10.12.6 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 8 milliseconds
  11. 11. What will be printed in console? B: Element page lost C: Nothing D: WrongLocatorException try{ $("element").waitUntil(appear, 3000);} catch(NoSuchElementException ex){ Assert.fail("Element page lost");} A: NoSuchElementException
  12. 12. Exception in thread "main" Element not found {#bad} Expected: visible Screenshot: file:/home/sergey/Github/demo/build/reports/tests/1505985705319.0 .png Timeout: 3.500 s. Caused by: NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"#bad"} try{ $(“element”).waitUntil(appear, 3000); }catch(UIAssertionError ex){ Assert.fail(“Element page lost”); }
  13. 13. Which text you got? A: “Text with spaces” B: “Text with spaces” C: Depends on browser D: “h1” <h1> Text with spaces </h1> findElement(By.tagName("h1")).getText();
  14. 14. element.getAttribute("textContent");
  15. 15. driver.manage().timeouts() .implicitlyWait(10,TimeUnit.SECONDS); wait = new WebDriverWait(driver,5); wait.until(ExpectedConditions .presenceOfElementLocated(locator)); How long will Selenium wait? A: 5 B: 15 C: 10 D: 0
  16. 16. Implicit Wait hereExplicit Wait here
  17. 17. Which exception will be thrown? B: None C: NoSuchElement D: Both A: Timeout driver.manage().timeouts() .implicitlyWait(10,TimeUnit.SECONDS); wait = new WebDriverWait(driver,5); wait.until(ExpectedConditions .presenceOfElementLocated(locator));
  18. 18. Which is faster? A: By.id B:By.Xpath C: They are equal D: By.css driver.findElement(By.id("someId")); driver.findElement(By.cssSelector("#someId"));
  19. 19. static id(id) { return By.css('*[id="'+ escapeCss(id) +'"]'); } public WebElement findElement(SearchContext context) { if (context instanceof FindsById) return ((FindsById) context).findElementById(id); return ((FindsByXPath)context) .findElementByXPath(".//*[@id = '" + id + "']"); }
  20. 20. How long will we wait here? A: 7 B: 12 C: 4 D: 3 driver.manage() .timeouts().implicitlyWait(3,SECONDS); $("wrongId"); driver.findElement(By.id("wrongId"));
  21. 21. What will happen? A: Test will pass B: Assert fail C:NullPointerException D: NoSuchElement class Page{ WebElement header; } driver.get(“http://google.com”); Page p = initElements(driver,Page.class); Assert(p.header.text() == “Google”);
  22. 22. INFO: Detected dialect: OSSException in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"name","selector":"header"} (Session info: chrome=60.0.3112.113) (Driver info: chromedriver=2.32.498537 (cb2f855cbc7b82e20387eaf9a43f6b99b6105061),platf orm=Mac OS X 10.12.6 x86_64) ...
  23. 23. What will happen? A: HateJSException B: WebDriverException C: Print Text D: Object console.log($('div').getText());
  24. 24. $(‘div’).getText() .then(function(text) { console.log(text); })
  25. 25. Thank you! https://www.facebook.com/yaroslav.pernerovskyhttps://www.facebook.com/spirogov

×