Skip to main content

Posts

Showing posts matching the search for selenium

What is WebDriver, WebDriver Command

What is Web Driver:- It is the most important component of Selenium, which is used to create scripts using Java, C#, PYTHON, etc to test web applications. Web drivers provide better customization and advanced testing operations on Web applications. It also uses a locator, command to create an automation test script. Web driver script can be executed in all standard Web browsers using Web browser Client-based software.  How to create infrastructure for Web Driver under selenium:- 1)  Install Java and Eclipse Software 2)  Download Selenium to manage Web Driver     https://www.selenium.dev/downloads/ 3)  Download Browser Client to run the script for all particular browsers.     https://www.selenium.dev/downloads/ 4) Open eclipse and create Java Project 5) Add Selenium Webdriver Jar file under project   Right click on project ----> Properties ----> Java Build Path ---- > Click on library ---> Add External JAR ---->  Then press...

Selenium with Python | How to write code of selenium web driver using Python Porgramming Language

Selenium with Python | How to write code of selenium web driver using Python Porgramming Language  What is selenium? It is automation based software system that is used to implement functional testing and regression testing operation for web application. selenium provide various component to pefrom testing operation using varius programming language. now the selenium 4 is the latest version of selenium. Selenium Component 1) Selenium IDE 1) Web Driver 3) Selenium GRID 4) Selenium Framework (Data driven, keyword driven, hybrid driven) python filename.py How to create selenium environment under windows for python programming language 1) install python (enable pip and configure python path) 2) open cmd and write  pip install selenium 3) create folder under any drive and open this folder using VS Code 4) create python file and write this script from selenium import webdriver driver = webdriver.Chrome() driver.get("https://www.google.com/") driver.quit() 5) open VS Code terminal a...

Drag and Drop Example in Selenium Web Driver

Drag and drop are mostly used to create UI from the backend or dashboard part. We can easily create a test script to implement drag and drop operation using the Action class Example of droppable  package basicexample; 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; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; public class DragandDropExample { public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver","d:\\chromedriver.exe");    WebDriver driver = new ChromeDriver();    driver.manage().window().maximize();   String URL = "https://demoqa.com/droppable/";   driver.get(URL);    // It is always advisable to Max...

File Uploading Script in Web Driver

HTML Code for File Uploading <input type="file" name="file"  /> We can create a path and pass it to the path under the file uploading content because the selenium web driver does not work under the dialog component. file upload component use sendKeys() to write file path under Web Driver WebDriver driver  = new ChromeDriver(); WebElement ele = driver.findElement(By.name("file")) ele.sendKey("path"); Complete Program For File Upload using Selenium Web Driver i mport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class FileUploadExample { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver","c:\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("http://demo.guru99.com/test/upload/"); WebElement ele = driver.findElement(By.name("uploa...

Handling Event in Web Driver:-

Event:-  if we perform any action in HTML Web Element or Page Context then event will be raised. WebDriver provides different event method's and classes to perform event operation. Classes for Event Actions Class:-  this class is used to manage an event of HTML web pages using different event method. WebDriver driver = new ChromeDriver(); Actions obj = new Actions(driver); Action:-  it is used to handle a particular event method of web element which will work under Action Class. Action ref = obj.eventmethod().build(); ref.perform(); Q)Create a script to get background color before mouseover and after mouseover on list item using hyperlink? 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.interactions.Action; import org.openqa.selenium.interactions.Actions; public class ActionExample { public static void main(String[] args) { Syste...