Very Iimportant Don't Delete
Very Iimportant Don't Delete
import java.awt.AWTException;
import java.awt.HeadlessException;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.datatransfer.StringSelection;
import java.net.MalformedURLException;
import java.net.URL;
import javax.imageio.ImageIO;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.Point;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.*;
int xcord;
int ycord;
Robot robot;
@BeforeTest
public void setUp() throws AWTException {
// @Test(priority = 0)
// public void pressingKeyboardKeys() throws AWTException, InterruptedException
{
// driver.get("https://ecommerce-playground.lambdatest.io/");
// driver.findElement(By.name("search")).sendKeys("iphone");
// driver.executeScript("lambda-perform-keyboard-events:{ENTER}");
// Thread.sleep(2000);
// }
@Test(priority = 1)
public void scrollingPage() throws AWTException, InterruptedException {
driver.get("https://ecommerce-playground.lambdatest.io/");
Thread.sleep(2000);
robot.mouseWheel(30);
robot.delay(2000);
robot.mouseWheel(-8);
}
// @Test(priority = 2)
// public void mouseHover() {
// driver.get("https://www.lambdatest.com/selenium-playground/hover-
demo");
//
// //calculating coordinates of the element to be hovered
// WebElement hoverButton = driver.findElement(By.className("border-
green-100"));
// Point p = hoverButton.getLocation();
// xcord = p.getX();
// ycord = p.getY();
// robot.delay(2000);
//
// //robot class to hover
// robot.mouseMove(xcord,ycord);
// robot.delay(2000);
// }
// // Uploading File
// @Test(priority =5)
// public void uploadFile() throws AWTException{
// driver.get("https://www.lambdatest.com/selenium-playground/upload-
file-demo");
// robot.delay(2000);
// // Path of the file to be uploaded
// driver.executeScript("lambda-set-clipboard:C:\\Users\\mohit\\
OneDrive\\Desktop\\demofile.png");
//
// // Clicking on the Upload Button
// robot.mouseMove(xcord,ycord);
// robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
//
// // Pressing the CTRL + V command
// driver.executeScript("lambda-perform-keyboard-events:^v");
//
// // Delaying for 2 seconds
// robot.delay(2000);
//
// // Hitting the enter key which will ultimately upload the file
// driver.executeScript("lambda-perform-keyboard-events:{ENTER}");
//
// robot.delay(2000);
// }
@AfterTest
public void quittingBrowser() {
driver.quit();