Exercise

hint

@Test
public void lab1(){
    System.setProperty("webdriver.gecko.driver","C:\\testautomatisering\\geckodriver.exe");
    WebDriver driver = new FirefoxDriver();

    driver.get("http://damberg.one/lab/lab2.html");
    driver.findElement(By.xpath("//*[text()='Zington']/..//button")).click();
    Assert.assertTrue(driver.findElement(By.id("result")).getText().equals("Zington"));

    driver.quit();
}        
    

Instructions

In this page, use the developer tools of your web browser to identify the “Open TCO” button on the row with the name “Zington” with the use of an XPath suitable for automation.

This time the buttons don't have proper ids to use. This makes the XPaths a bit more complex.

Bonus if the same XPath works in other browsers (note that some webkits inserts their own TBODY and THEAD part of tables).




Status Company
Active ICA
Closed WM-Data
Active Zington
Active Knowit
Passive Angpanneforeningen

Chosen company: None