ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Handling Keyboard events in Selenium Automation II WebDriver Selenium Automation

Автор: Knowledge Share

Загружено: 2020-12-03

Просмотров: 719

Описание: In this session you will be learning the importance of keyboard events in selenium automation and its significance in various applications with examples

You can download this example program by scrolling to the bottom on the description and also you can import the complete example programs from below GitHub Repository
https://github.com/knowledgeshare-tec...
*******************************************************************
You can see step by step selenium sessions from below playlist
*******************************************************************
   • How to handle WebTables using Selenium Web...  

For regular updates you can join this Group
***********************************************
  / 4754296501308288  
****************************************************
Overview on Keyboard Events
****************************************************
What are Keyboard Events

Pressing a Key/Keys on a Keyboard (or) user interaction with the keyboard

Different ways to automate Keyboard Events
Using sendKeys() method of WebElement class
Using Actions class
Using Robot class
What is the use to handle this Keyboard events
To perform Copy & Paste ( Control + c, Control + v)
Holding keys like Shift , Alt, F1 to F12 to perform some operations on Application
When mouse clicks are not happening in any applications
Mostly used to press Tab and Enter Keys in a form etc.,
***********************************************************
Example program for handling Keyboard Events.
***********************************************************
package com.seleniumbasics;

import java.awt.AWTException;
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.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;

public class Keyboard_Events {

public static void main(String[] args) throws AWTException, InterruptedException
{
System.setProperty("webdriver.chrome.driver", ".\\drivers\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.navigate().to("http://demowebshop.tricentis.com/regi...");

driver.manage().window().maximize();

driver.findElement(By.id("gender-male")).click();

//Method - 1
/*
Actions action=new Actions(driver); action.sendKeys(Keys.TAB);
action.sendKeys("test1"); action.sendKeys(Keys.TAB);
action.sendKeys("test2"); action.sendKeys(Keys.TAB);
action.sendKeys("[email protected]"); action.sendKeys(Keys.ENTER);
action.build().perform();
*/

//Method - 2
Actions action=new Actions(driver);
action.sendKeys(Keys.TAB)
.sendKeys("test1")
.sendKeys(Keys.TAB)
.sendKeys("test2")
.sendKeys(Keys.TAB)
.sendKeys("[email protected]")
.sendKeys(Keys.ENTER)
.build().perform();

//Using Robot Class - java based class

Robot robot=new Robot();

robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);

robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);

Thread.sleep(3000);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);

}

}

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Handling Keyboard events in Selenium Automation II WebDriver Selenium Automation

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]