Creating a Maven project from Command line

  • 03
    Jul

    Creating a Maven project from Command line

    mvn archetype:generate -DarchetypeArtifactId=maven.archetype.quickstart -DgroupId=org.example -DartifactId=skeleton.web.services -DinteractiveMode=false   mvn spring-boot:run   mvn clean package¬† and java -jar target/skeleton.web.services-1.0-SNAPSHOT.jar  

    Read More
  • 27
    Jun

    How to capture screenshot in Selenium webdriver

    package Screenshot; import java.io.File; import java.io.IOException; import org.apache.commons.io.FileUtils; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.Test; public class ScreenshootGoogle { @Test public void TestJavaS1() { WebDriver driver...

    Read More
  • 27
    Jun

    Executing tests in parallel with TestNG Framework

    Step 1: Create a testing.xml with parallel keyword as Step 2: create PE1 and PE2 classes (which needs to be executed in parallel) package TestNG; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver;...

    Read More
  • 26
    Jun

    select random item from drop down in selenium

    public static void selectDropDownDataRandomly(WebElement webElement) { Select dropdown = new Select(webElement); dropdown.selectByIndex(randomNumber(dropdown.getOptions().size())); } // function to get random number between 0 to number public static int randomNumber(int number) {...

    Read More
  • 26
    Jun

    select drop down value by visible text / index value

    public static void selectDropDownByVisibleText(WebElement webElement, String visibleText) { Select dropdown = new Select(webElement); if(visibleText ==null ||visibleText.isEmpty()){ return; } dropdown.selectByVisibleText(visibleText); System.out.println(“Value selected:{} “, visibleText); } ======================================================= public static void selectDropDownByIndex(MCWebElement...

    Read More
  • 26
    Jun

    Register nodes with Selenium grid

    Register hub: Step 1. Navigate to standalone server jars folder and enter following command: java -jar selenium-server-standalone-3.12.0.jar -port 4444 -role hub note down following lines (from output of above...

    Read More
  • 26
    Jun

    check if a checkbox is checked in selenium webdriver

    package SeleniumPractice; import java.text.ParseException; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.interactions.Actions; import org.testng.Assert; import org.testng.annotations.Test; public class AddCookiesInSelenium { WebDriver driver; @Test...

    Read More
  • 26
    Jun

    scroll a long web page in selenium webdriver

    package SeleniumPractice; import java.text.ParseException; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.interactions.Actions; import org.testng.Assert; import org.testng.annotations.Test; public class AddCookiesInSelenium { WebDriver driver; @Test...

    Read More
  • 26
    Jun

    drag and drop with selenium webdriver

    package SeleniumPractice; import java.text.ParseException; 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.testng.Assert; import org.testng.annotations.Test; public class DragAndDropInSelenium { WebDriver driver; @Test public void...

    Read More
  • 26
    Jun

    working with menus in Selenium (mouseover and click on link)

    package SeleniumPractice; import java.text.ParseException; 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.testng.annotations.Test; public class Workingwithmenus { WebDriver driver; @Test public void enterText() throws InterruptedException, ParseException...

    Read More