7
HEADLESS TESTING WITH SELENIUM AND PHANTOMJS Paweł Guździoł

Paweł Guździoł - Hheadless functional testing with selenium and phantomjs

Embed Size (px)

Citation preview

Page 1: Paweł Guździoł - Hheadless functional testing with selenium and phantomjs

HEADLESS TESTING WITH SELENIUM AND PHANTOMJS Paweł Guździoł

Page 2: Paweł Guździoł - Hheadless functional testing with selenium and phantomjs

HEADLESS TESTING PhantomJS - is a WebKit-based browser without a GUI GhostDriver - is a pure JavaScript implementation of the WebDriver Wire Protocol for PhantomJS

Page 3: Paweł Guździoł - Hheadless functional testing with selenium and phantomjs

ARCHITECTURE IMPLEMENTATION OF GHOSTDRIVER

Source: http://www.assertselenium.com/headless-testing/getting-started-with-ghostdriver-phantomjs/

Page 4: Paweł Guździoł - Hheadless functional testing with selenium and phantomjs

SETUP1. Download PhantomJS2. Extract an exe file3. Set the phantomjs in the PATH

4. Start the PhantomJs in a Remote WebDriver modephantomjs.exe –webdriver=8910

Page 5: Paweł Guździoł - Hheadless functional testing with selenium and phantomjs

EXAMPLE @Test public void testDuckDuckGoSearching(){ WebDriver driver = new PhantomJSDriver(); driver.manage() .timeouts() .implicitlyWait(5, TimeUnit.SECONDS); driver.get("https://duckduckgo.com"); driver.findElement(By.id("search_form_input_homepage")) .sendKeys("Selenium"); driver.findElement(By.id("search_button_homepage")) .click(); String result = driver.findElement(By.id("r1-0")) .getText(); assertTrue(result.contains("Selenium - Web Browser Automation")); } }

Page 6: Paweł Guździoł - Hheadless functional testing with selenium and phantomjs

BENCHMARKING Firefox – 21 s PhantomJS – 7s

Page 7: Paweł Guździoł - Hheadless functional testing with selenium and phantomjs

THANKS!