Apply POM to GettingStarted
This commit is contained in:
parent
ae1223a949
commit
c3bb40338e
|
|
@ -0,0 +1,18 @@
|
||||||
|
package pages.webdriver;
|
||||||
|
|
||||||
|
import org.openqa.selenium.WebDriver;
|
||||||
|
|
||||||
|
public class GettingStartedPage
|
||||||
|
{
|
||||||
|
private WebDriver driver = null;
|
||||||
|
|
||||||
|
public GettingStartedPage(WebDriver driver)
|
||||||
|
{
|
||||||
|
this.driver = driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle()
|
||||||
|
{
|
||||||
|
return this.driver.getTitle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
package webdriver;
|
package tests.webdriver;
|
||||||
|
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||||
|
|
||||||
public class GettingStarted
|
import pages.webdriver.GettingStartedPage;
|
||||||
|
|
||||||
|
public class GettingStartedTests
|
||||||
{
|
{
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
|
|
@ -20,7 +22,8 @@ public class GettingStarted
|
||||||
// 4. Interact with WebElements.
|
// 4. Interact with WebElements.
|
||||||
// When testing on a web page we want to make sure that something in it matches an expected value.
|
// When testing on a web page we want to make sure that something in it matches an expected value.
|
||||||
// For example, this tests that the title of the web page is what we expect:
|
// For example, this tests that the title of the web page is what we expect:
|
||||||
String actual = driver.getTitle();
|
GettingStartedPage page = new GettingStartedPage(driver);
|
||||||
|
String actual = page.getTitle();
|
||||||
String expected = "ramoncaballero.dev - Selenium Playground";
|
String expected = "ramoncaballero.dev - Selenium Playground";
|
||||||
assert actual.equals(expected);
|
assert actual.equals(expected);
|
||||||
|
|
||||||
|
|
@ -29,4 +32,4 @@ public class GettingStarted
|
||||||
// 5. End the session:
|
// 5. End the session:
|
||||||
driver.quit();
|
driver.quit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue