NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Week 4

package CMRIT.CMRIT_Assignment;

import java.util.HashMap;
import java.util.Map;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class Banking_siteAlertPopup {
public static void main(String[] args) throws InterruptedException
{
Map<String, Object> prefs = new HashMap<String, Object>();
//add key and value to map as follow to switch off browser notification
//Pass the argument 1 to allow and 2 to block
prefs.put("profile.default_content_setting_values.notifications", 2);
//Create an instance of ChromeOptions
ChromeOptions options = new ChromeOptions();
// set ExperimentalOption - prefs
options.setExperimentalOption("prefs", prefs);
System.setProperty("webdriver.chrome.driver","C:\Users\LENOVO\Downloads\chro
medriver.exe");
WebDriver driver = new ChromeDriver(options);
driver.manage().window().maximize();driver.get("https://www.axisbank.com/");

Thread.sleep(2000);

WebElement popupClose =

driver.findElement(By.xpath("/html[1]/body[1]/div[1]/div[1]/div[1]"));

popupClose.click();
driver.close();
Thread.sleep(2000);
}
}
,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,
Week 5
package CMRIT.CMRIT_Assignment;

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
public class CMRIT_StudentResults {
public static void main(String[] args) throws InterruptedException
{
System.setProperty("webdriver.chrome.driver","C:\Users\LENOVO\Downloads\chro
medriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.google.com/");
Thread.sleep(2000);
WebElement searchBar = driver.findElement(By.name("q"));
searchBar.sendKeys("CMRIT");
searchBar.sendKeys(Keys.ENTER);
WebElement cmritLink =
driver.findElement(By.xpath("(//h3[contains(text(),'Home - CMR Institute Of Technology ,
Hyderabad, Te')])[1]"));
cmritLink.click();
Thread.sleep(3000);Actions builder = new Actions(driver);

WebElement student =

driver.findElement(By.xpath("/html[1]/body[1]/div[1]/div[1]/section[3]/div[1]/div[1]/div[1]/div[
1]/div[1]/nav[1]/ul[1]/li[9]/a[1]"));
builder.moveToElement(student).perform();
student.click();
Thread.sleep(2000);
WebElement studentLogin =
driver.findElement(By.xpath("/html[1]/body[1]/div[1]/div[1]/section[3]/div[1]/div[1]/div[1]/div[
1]/div[1]/nav[1]/ul[1]/li[9]/ul[1]/li[1]/a[1]"));
studentLogin.click();
WebElement userName =
driver.findElement(By.xpath("(//input[@id='txtUserName'])[1]"));
Thread.sleep(2000);
userName.sendKeys("20R01A05K6p");
WebElement nxtBtn = driver.findElement(By.name("btnNext"));
nxtBtn.click();
WebElement password =
driver.findElement(By.xpath("(//input[@placeholder='Enter Password'])[1]"));
password.sendKeys("20R01A05K6P");
WebElement submit =
driver.findElement(By.xpath("(//input[@name='btnSubmit'])[1]"));
submit.click();
}
}
,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,
Week 7

package CMRIT.CMRIT_Assignment;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class GoogleSearch_CMRIT {
public static void main(String[] args) throws InterruptedException
{
System.setProperty("webdriver.chrome.driver","C:\Users\LENOVO\Downloads\chro
medriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com/");
driver.manage().window().maximize();
Thread.sleep(2000);
WebElement searchBar = driver.findElement(By.name("q"));
searchBar.sendKeys("CMRIT");
searchBar.sendKeys(Keys.ENTER);
Thread.sleep(15000);
driver.quit();
}
}
,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,

Week 8

package CMRIT.CMRIT_Assignment;

import java.awt.Robot;

import java.awt.event.KeyEvent;

import org.openqa.selenium.By;

import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
public class GoogleImageDownload {
public static void main(String[] args) throws Exception {
System.setProperty("webdriver.chrome.driver","C:\Users\LENOVO\Downloads\ch
romedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.google.com/");
Thread.sleep(2000);
WebElement searchBar = driver.findElement(By.name("q"));
searchBar.sendKeys("CMRIT");
searchBar.sendKeys(Keys.ENTER);
Thread.sleep(2000);
driver.findElement(By.xpath("//a[normalize-space()='Images']")).click();
WebElement Image = driver.findElement(By.xpath("//img[@alt='The CMRIT
Campus - CMR IT']"));
Actions action = new Actions(driver);
action.contextClick(Image).build().perform();
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_DOWN);
Thread.sleep(500);
robot.keyPress(KeyEvent.VK_DOWN);
Thread.sleep(500);
robot.keyPress(KeyEvent.VK_DOWN);
Thread.sleep(500);
robot.keyPress(KeyEvent.VK_DOWN);
Thread.sleep(500);
robot.keyPress(KeyEvent.VK_DOWN);
Thread.sleep(500);
robot.keyPress(KeyEvent.VK_DOWN);
Thread.sleep(500);
robot.keyPress(KeyEvent.VK_DOWN);
Thread.sleep(500);
robot.keyPress(KeyEvent.VK_DOWN);
Thread.sleep(500);
robot.keyPress(KeyEvent.VK_ENTER);
Thread.sleep(3000);
robot.keyPress(KeyEvent.VK_ENTER);
System.out.println("downloaded");
driver.close();
}
}

,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,
Week 9

package CMRIT.CMRIT_Assignment;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class listItems
{
public static void main(String[] args)
{
System.setProperty("webdriver.chrome.driver","C:\Users\LENOVO\Downloads\chro
medriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
//URL launch
driver.get("https://www.justdial.com/Bangalore/Bakeries");
// identify elements list with same class nam5e
List<WebElement> m = driver.findElements(By.xpath("//h2[@class='store-name']"));
// iterate over list
for(int i = 0; i< m.size(); i++) {
//obtain text
String s = m.get(i).getText();
System.out.println("Text is: " + s);
}
driver.quit();
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.