This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void test_login_using_relative_locators_3(){ | |
WebElement txt_name = driver.findElement(withTagName("input") | |
.toLeftOf(By.id("addbutton")) | |
.below(By.name("li5"))); | |
txt_name.sendKeys("Relative locators test"); | |
// Get details of the Submit/Add button | |
WebElement submitbutton = driver.findElement(By.xpath("//*[@id=\'addbutton\']")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WebDriver driver = new ChromeDriver(); | |
Or | |
WebDriver driver = new FirefoxDriver(); | |
Or | |
WebDriver driver = new EdgeDriver(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WebDriver driver = new RemoteWebDriver(new URL("https://" + username + ":" + accesskey + "@hub.lambdatest.com/wd/hub"), | |
DesiredCapabilities.firefox()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String username = "yadneshshah91"; //your LambdaTest username | |
public String accesskey = "1234ABCD"; //your LambdaTest access key | |
public static RemoteWebDriver driver = null; | |
public String gridURL = "@hub.lambdatest.com/wd/hub"; //LambdaTest Hub URL | |
boolean status = false; | |
//Setting up capabilities to run our test script | |
@Parameters(value= {"browser","version"}) | |
@BeforeClass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Closing the browser session after completing each test case | |
@AfterClass | |
public void tearDown() throws Exception { | |
if (driver != null) { | |
((JavascriptExecutor) driver).executeScript("lambda-status=" + status); | |
driver.quit(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Verifying elements on Registration page | |
@Test | |
public void verifyElemntsOnPageTest() | |
{ | |
WebElement lambdaTestLogo = driver.findElement(By.xpath("//p[@class='signup-titel']")); | |
lambdaTestLogo.isDisplayed(); | |
WebElement signUpTitle = driver.findElement(By.xpath("//p[@class='signup-titel']")); | |
signUpTitle.isDisplayed(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Registration with all valid data | |
@Test | |
public void validRegistrationTest(){ | |
WebElement companyName = driver.findElement(By.name("organization_name")); | |
companyName.sendKeys("TestCompany"); | |
WebElement fullName = driver.findElement(By.name("name")); | |
fullName.sendKeys("TestName"); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd"> | |
<suite thread-count="3" name="LambaTestSuite" parallel="tests"> | |
<test name="FirefoxTest"> | |
<parameter name="browser" value="firefox"/> | |
<parameter name="version" value="69.0"/> | |
<classes> | |
<class name="com.lambdatest.SignUpTest"/> | |
</classes> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Registration without providing Company Name field | |
@Test | |
public void emptyCompanyNameTest() | |
{ | |
WebElement companyName = driver.findElement(By.name("organization_name")); | |
companyName.sendKeys(""); | |
WebElement fullName = driver.findElement(By.name("name")); | |
fullName.sendKeys("TestName"); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Verifying redirection to the terms and conditions page | |
@Test | |
public void termsRedirectionTest() | |
{ | |
WebElement termsLink = driver.findElement(By.xpath("//a[contains(text(),'Terms')]")); | |
termsLink.click(); | |
Set <String> allWindows = driver.getWindowHandles(); | |
for(String handle : allWindows) |