My First Chrome Test

    ## My First Chrome Test


In this video I create a very simple test using Chrome. The test will be very similar to the one in the start Using Selenium WebDriver project, but you'll see it being created, and I explain what I'm doing.


You'll see:


- creating a new driver object

- navigating to a page

- asserting on title

- using dev tools to find title

- using debug mode

the application under test is hosted on heroku


---


Notes:


new driver

driver.navigate().to("https://testpages.herokuapp.com")



adding selenium webdriver to pom.xml does not add the drivers, it used to (it used to include htmlunit and Firefox driver)


This is good, we can update Selenium WebDriver and the Drivers independently - update driver when browsers changes but not need to change WebDriver


class MyFirstChromeDriverTest


Test method driverIsTheKing


because Driver is the king, everything in WebDriver stems from, or uses a Driver


open page - webdriver syncs on page load so it waits for the HTML to load into the browser


assert title with Assert.assertTrue


~~~~~~~~

        WebDriver driver = new ChromeDriver();


        driver.navigate().to("https://testpages.herokuapp.com/");


        Assert.assertTrue(

                            driver.getTitle().startsWith("Selenium"));


        driver.close();

        driver.quit();

~~~~~~~~   

Discussion

2 comments