Rv
Rvunknown
java
3 years ago
1.6 kB
8
Indexable
package webdriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; public class Topic_04_Browser_Element_Method { WebDriver driver; String projectPath = System.getProperty("user.dir"); @BeforeClass public void beforeClass() { System.setProperty("webdriver.gecko.driver", projectPath + "\\browserDrivers\\geckodriver.exe"); driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); driver.manage().window().maximize(); driver.get("https://www.live.techpanda.org/"); } @Test public void TC_01_VerifyUrl() { driver.get("https://www.live.techpanda.org/"); WebElement myAccountfooter = driver.findElement(By.xpath("//div[@class='footer']//a[@title='My Account']")); myAccountfooter.click(); String techPageUrllogin = driver.getCurrentUrl(); Assert.assertEquals(techPageUrllogin, "https://www.live.techpanda.org/index.php/customer/account/login/"); WebElement createAnAcountbtn = driver.findElement(By.xpath("//span[contains(text(),'Create An Account')")); createAnAcountbtn.click(); String techPageUrlregister = driver.getCurrentUrl(); Assert.assertEquals(techPageUrlregister, "https://www.live.techpanda.org/index.php/customer/account/create/"); } @AfterClass public void afterClass() { driver.quit(); } }
Editor is loading...