Selenium_UML_Computer Science, Essays (high school) of Computer science

Demo Demo Demo Demo Demo Demo Demo

Typology: Essays (high school)

2019/2020

Uploaded on 10/12/2023

clash-royale-82
clash-royale-82 🇮🇳

1 document

1 / 27

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PROGRAM 1: Develop a Test to Open a Chrome Browser Using
Selenium WebDriver
CODING:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class pro1 {
public static void main(String[] args)throws InterruptedException {
System.setProperty("webdriver.chrome.driver","C:\\Users\\gokul\\Downloads\\c
hromedriver-win64\\chromedriver-win64\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https:/www.google.com");
}
}
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b

Partial preview of the text

Download Selenium_UML_Computer Science and more Essays (high school) Computer science in PDF only on Docsity!

PROGRAM 1: Develop a Test to Open a Chrome Browser Using

Selenium WebDriver

CODING:

import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class pro1 { public static void main(String[] args)throws InterruptedException { System.setProperty("webdriver.chrome.driver","C:\Users\gokul\Downloads\c hromedriver-win64\chromedriver-win64\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("https:/www.google.com"); } }

OUTPUT:

RESULT:

The selenium test was executed successfully.

OUTPUT:

RESULT:

The selenium test was executed successfully.

Program 3: Develop Tests to Upload a File with Send Keys Method by

Using Web Driver

CODING:

import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class selenium3 { public static void main(String[] args) throws InterruptedException { // Set the path to the ChromeDriver executable System.setProperty("webdriver.chrome.driver", "/home/skasc/Downloads/chromedriver"); WebDriver driver = new ChromeDriver(); driver.get("http://www.google.com"); driver.findElement(By.name("q")).sendKeys("selenium"); driver.findElement(By.name("q")).sendKeys(Keys.ENTER); driver.findElement(By.className("Tg7LZd")).click(); driver.quit(); } }

Program 4: Automate To Access A Link In Selenium Web Driver By

Linktext() And Partiallinktext()

CODING:

import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class pro1 { public static void main(String[] args) throws InterruptedException { // TODO Auto-generated method stub System.setProperty("webdriver.chrome.driver","C:\Users\gokul\Downloads\c hromedriver-win64\chromedriver-win64\chromedriver.exe"); WebDriver driver=new ChromeDriver(); driver.get("https://www.google.com"); driver.findElement(By.linkText("Sign in")).click(); driver.findElement(By.partialLinkText("Sign")).click(); driver.findElement(By.id("identifierID")).sendKeys("[email protected]"); } }

OUTPUT:

RESULT:

The selenium test was executed successfully.

OUTPUT:

RESULT:

The selenium test was executed successfully.

Program 6: Develop a test To Locate a Frame Using Tag Name

CODING:

import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class pro1 { public static void main(String[] args) throws InterruptedException { // TODO Auto-generated method stub System.setProperty("webdriver.chrome.driver","C:\Users\gokul\Downloads\c hromedriver-win64\chromedriver-win64\chromedriver.exe"); WebDriver driver=new ChromeDriver(); driver.get("https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_button_ test"); driver.manage().window().maximize(); driver.switchTo().frame("iframeResult"); driver.findElement(By.xpath("/html/body/button")).click(); driver.switchTo().defaultContent(); } }

Program 7(a): Develop a Test to Synchronize with an implicit wait

CODING:

import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class pro7a { public static void main(String[] args)throws InterruptedException { System.setProperty("webdriver.chrome.driver", "C:\Users\gokul\Downloads\chromedriver-win64\chromedriver- win64\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("https://phptravels.com/demo/"); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(300,TimeUnit.SECONDS); driver.close(); } }

OUTPUT:

RESULT:

The selenium test was executed successfully.

OUTPUT:

RESULT:

The selenium test was executed successfully.

Program 8: Test the case by Identifying and handling a pop-up window

by its name

CODING:

import org.openqa.selenium.By; import org.openqa.selenium.Alert; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class pro { public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver","C:\Users\gokul\Downloads\c hromedriver-win64\chromedriver-win64\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("https://demo.guru99.com/test/delete_customer.php"); driver.findElement(By.name("cusid")).sendKeys("53920"); driver.findElement(By.name("submit")).submit(); Alert alert = driver.switchTo().alert(); String alertMessage= driver.switchTo().alert().getText(); System.out.println(alertMessage); Thread.sleep(5000); alert.accept(); }}

Program 9: Draw a Class Diagram with Associations and Relationships

Output:

scenario: Online shopping

Result:

Thus the class diagram has successfully created.

Program 10: Draw a Class Diagram with a real System to handle

Exceptional condition

Output:

Scenario:Bank management system

Result:

Thus the class diagram has successfully created.