0% found this document useful (0 votes)
138 views6 pages

VTOP Login Process for Students

This document contains code examples for using Selenium WebDriver with Java to automate tests on web applications. It includes examples of finding elements by ID, name, XPath, interacting with dropdown menus, and using get() and getText() methods. The code examples demonstrate automating actions like entering text, clicking buttons, and retrieving page titles on websites like Facebook and Google.

Uploaded by

Gaganya Mohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
138 views6 pages

VTOP Login Process for Students

This document contains code examples for using Selenium WebDriver with Java to automate tests on web applications. It includes examples of finding elements by ID, name, XPath, interacting with dropdown menus, and using get() and getText() methods. The code examples demonstrate automating actions like entering text, clicking buttons, and retrieving page titles on websites like Facebook and Google.

Uploaded by

Gaganya Mohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ASSIGNMENT-11

A2 SLOT

Course Program: Int. M. Tech

Course code: SWE-3006

Course Title: Advance Software Testing

Batch:2020-2025

Submitted to

[Link] E

Submitted by
Sathish Kumar V- 20MIS1080
VTOP Login:

CODE:

package lab11;

import [Link];

import [Link];

public class test {

public static void main(String[] args)

{
[Link]("[Link]","C:\\Users\\sathi\\Downloads\\geckodriver-
v0.33.0-win64\\[Link]");

// FirefoxOptions options = new FirefoxOptions();

FirefoxDriver driver= new FirefoxDriver();

[Link]("[Link]

[Link]([Link]("username")).sendKeys("20MIS1080");

[Link]([Link]("password")).sendKeys("vit");

[Link]([Link]("submitBtn")).click();

[Link]();

}
Example ( for id and name):

import [Link];
import [Link];
public class firstlastest {
public static void main(String[] args)
{
[Link]("[Link]","E:\\gecko\\geckodriver.e
xe");

// FirefoxOptions options = new FirefoxOptions();


FirefoxDriver driver= new FirefoxDriver();
[Link]("[Link]
[Link]([Link]("email")).sendKeys("Advance Software
testing");
[Link]([Link]("pass")).sendKeys("vit");
[Link]([Link]("login")).click();
[Link]();
}

Example xpath

import [Link];
import [Link];

public class xpath {


public static void main(String[] args)
{

[Link]("[Link]","E:\\gecko\\geckodriver.e
xe");
// FirefoxOptions options = new FirefoxOptions();
FirefoxDriver driver= new FirefoxDriver();

[Link]("[Link]

[Link]([Link]("//*[@id=\"APjFqb\"]")).sendKeys("vit");

[Link]([Link]("/html/body/div[1]/div[3]/form/div[1]/div[1]/di
v[4]/center/input[1]")).click();
[Link]();
}
}

Example – drop down menu

package latestversion;

import [Link];
import [Link];
import [Link];
import [Link];

public class drop {


public static void main(String[] args)
{

[Link]("[Link]","E:\\gecko\\geckodriver.e
xe");

// FirefoxOptions options = new FirefoxOptions();


FirefoxDriver driver= new FirefoxDriver();

[Link]("[Link]
Select drop1 = new
Select([Link]([Link]("month")));
Select drop2= new
Select([Link]([Link]("day")));
[Link](3);
[Link]("Mar");

[Link]();
}

Example –get() & getText()

package lab11;
import [Link];
import [Link];
import [Link];
public class title {
public static void main(String[] args)
{

[Link]("[Link]","C:\\Users\\sathi\\Downloads\\geckodri
ver-v0.33.0-win64\\[Link]");
// FirefoxOptions options = new FirefoxOptions();
FirefoxDriver driver= new FirefoxDriver();
[Link]("[Link]
[Link]("Page title is : " + [Link]());
WebElement element1=[Link]([Link]("login"));
[Link]("button text is : " + [Link]());
[Link]();
}
}

You might also like