Selenium Beginner Tutorial 13 - How to use HtmlUnit Driver
Note- HtmlUnitDriver is not available in selenium 3.x version. HtmlUnitDriver to use this concept, we have to download htmlunitdriver JAR file https://github.com/SeleniumHQ/htmlunit-driver/releases Pre-requisites - Selenium jars should be added to the project. This is covered in the earlier session on this series. Selenium Beginner 5 - How to write first Selenium script (java) - 5 Easy Steps https://www.youtube.com/watch?v=7yYDOja8n_k&list=PLhW3qG5bs-L_s9HdC5zNshE5Ti8jABwlU&index=5&t=441s Today we will learn : ------------------------------- 1. What is HtmlUnit Driver 2. How to run test with HtmlUnit Driver HtmlUnitDriver driver = new HtmlUnitDriver(); driver.get("http://seleniumhq.org/"); 3. How to emulate other browsers HtmlUnitDriver driver = new HtmlUnitDriver ( BrowserVersion.CHROME ); _______________________________________________________________ Helpful Tips: ------------------- How to confirm and validate that your test ran on some specific browser WebClient webClient = (WebClient) get(driver, "webClient"); private static Object get(Object object, String field) throws Exception { Field f = object.getClass().getDeclaredField(field); f.setAccessible(true); return f.get(object); } _______________________________________________________________ Interview Section: ---------------------------- Q. What is HtmlUnit Driver technically in Selenium library. _______________________________________________________________ References: HtmlUnit Browser - https://en.wikipedia.org/wiki/HtmlUnit HtmlUnit Driver - https://github.com/SeleniumHQ/selenium/wiki/HtmlUnitDriver HtmlUnitDriver documentation - http://seleniumhq.github.io/htmlunit-driver/org/openqa/selenium/htmlunit/HtmlUnitDriver.html#HtmlUnitDriver-com.gargoylesoftware.htmlunit.BrowserVersion- Webdriver documentation - http://seleniumhq.github.io/selenium/docs/api/java/ ________ ONLINE COURSES TO LEARN ________ Visit - https://automationstepbystep.com/ Ask Raghav- https://bit.ly/2CoJGWf Interviews - https://bit.ly/2NIPPxk All Playlists - https://bit.ly/2LSiezA ------------ Follow ------------ Facebook - https://www.facebook.com/automationstepbystep Twitter - https://twitter.com/automationsbs Youtube - http://youtube.com/automationstepbystep Like, Subscribe, Share You can support my mission for education by sharing this knowledge and helping as many people as you can
Download
1 formatsVideo Formats
Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.