<repo_name>suchita-thorat/SeleniumMavenJunit<file_sep>/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>groupId</groupId>
    <artifactId>SeleniumMavenJunit</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.4.0-M1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.4.0-M1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-firefox-driver</artifactId>
            <version>3.141.59</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-chrome-driver</artifactId>
            <version>2.50.0</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.12.0</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-support</artifactId>
            <version>3.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>22.0</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.16</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.16</version>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>3.0.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.5</version>
        </dependency>
    </dependencies>
    <build>
    <plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.1.0</version>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.1</version>
    </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M3</version>
            <configuration>
                <includes>
                    <include>FirstTest.java</include>
                    <include>HomePageTest.java</include>
                    <include>RestAPITest.java</include>
                    <runOrder>alphabetical</runOrder>
                </includes>
            </configuration>
        </plugin>
    </plugins>
    </build>
</project><file_sep>/src/test/java/FirstTest.java
import org.junit.Assert;
import org.junit.jupiter.api.*;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.*;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.awt.*;
import java.awt.datatransfer.StringSelection;
import java.awt.event.KeyEvent;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.FileInputStream;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.FileWriter;
import java.util.Random;

@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class FirstTest {
    static WebDriver driver;

   @BeforeAll
     public static void setup() throws InterruptedException{
        System.setProperty("webdriver.chrome.driver","C:\\BrowserDriver\\chromedriver.exe");
        driver = new ChromeDriver();
        driver.manage().window().maximize();
        driver.manage().deleteAllCookies();
        driver.get("https://freecrm.com/");

       //Creating the JavascriptExecutor interface object by Type casting
       JavascriptExecutor js = (JavascriptExecutor)driver;

       //Get current page title using Java Script Executor
       String pagetitle=(String)js.executeScript("return document.title");
       System.out.println("Page Title Is  : "+pagetitle);

   }
 /* Issue with Recatcha while doing signup
    @Test
    public void signup() throws InterruptedException{
        driver.findElement(By.linkText("SIGN UP")).click();
        Thread.sleep(2000);
        driver.findElement((By.id("email"))).sendKeys("<EMAIL>");
        driver.findElement((By.id("phone_number"))).sendKeys("7718201178");
        driver.findElement((By.id("terms"))).click();
       // driver.findElement((By.className("recaptcha-checkbox-border"))).click();
        Thread.sleep(20000);
        driver.findElement(By.name("action")).click();
    }
    */

   @Test
   @Order(1)
   //Login Test
   public void login() throws InterruptedException{
       driver.findElement(By.linkText("LOG IN")).click();
       Thread.sleep(1000);
       driver.findElement((By.name("email"))).sendKeys("<EMAIL>");
       driver.findElement((By.name("password"))).sendKeys("<PASSWORD>");
       driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div/form/div/div[3]")).click();
       Thread.sleep(1000);
      //Verify successful login
       assertEquals("https://ui.freecrm.com/",driver.getCurrentUrl());
   }


    @Test
    @Order(2)
    //Adding new contact
    public void addContact() throws InterruptedException {
       //Click on Contacts section from Left hand pane
        Thread.sleep(500);
       driver.findElement(By.linkText("Contacts")).click();
       driver.findElement(By.xpath("//*[@id=\"dashboard-toolbar\"]/div[2]/div/a/button")).click();
        //Explicit Wait - To load new contact details filling page
       WebDriverWait wait = new WebDriverWait(driver,2000);
       WebElement ele1=wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[1]/div[1]/div/div/input")));
       ele1.sendKeys("Suchita");
       driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[2]/div[1]/div/div/input")).sendKeys("Thorat");
       driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[4]/div/div/div/div/div[1]/input")).sendKeys("<EMAIL>");
       //Click Save button (to save/add contact)
       driver.findElement(By.xpath("//*[@id=\"dashboard-toolbar\"]/div[2]/div/button[2]")).click();
       Thread.sleep(1000);
       //Click On Contacts again to get contacts list
       driver.findElement(By.linkText("Contacts")).click();
       Thread.sleep(1000);
       //Find the recently added contact
        //Use Xpath axis
        String emailid = driver.findElement(By.xpath("//td[contains(text(),'Suchita')]/following-sibling::td[3]")).getText();
        //System.out.println(emailid);
        //Verifying addition of contact
        Assertions.assertEquals("<EMAIL>",emailid);
        //Creating the JavascriptExecutor interface object by Type casting
        JavascriptExecutor js = (JavascriptExecutor)driver;
        //Bordering emailid using JavaScript Executor before taking screenshot
        js.executeScript("arguments[0].style.border='3px solid red'",(driver.findElement(By.xpath("//td[contains(text(),'Suchita')]/following-sibling::td[3]"))));
        Thread.sleep(1000);

       //taking screenshot of added contact
        File src= ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
        try {
            // now copy the  screenshot to desired location using copyFile method
            FileUtils.copyFile(src, new File("C:/SeleniumScreenshots/AddedContact.png"));
        }
        catch (IOException e)
        {
            System.out.println(e.getMessage());

        }
        // now delete recently added contact so to add it next time uniquely
        driver.findElement(By.xpath("//td[contains(text(),'Suchita')]/following-sibling::td[4]/div/button/i")).click();
        driver.findElement(By.xpath("//div[.='Move to the bin']/following-sibling::div[2]/button[2]")).click();
        Thread.sleep(1000);
        //To generate Alert window using JavascriptExecutor. Display the alert message
        js.executeScript("alert('Earlier added contact deleted now!');");
        Thread.sleep(1000);
        driver.switchTo().alert().accept();
    }

    @Test
    @Order(3)
    //Reading data from Excel and creating contact from that details
    public void addExcelContact() throws InterruptedException, FileNotFoundException, IOException {
        //Click on Contacts section from Left hand pane
        Thread.sleep(500);
        driver.findElement(By.linkText("Contacts")).click();
        //Click on New button
        driver.findElement(By.xpath("//*[@id=\"dashboard-toolbar\"]/div[2]/div/a/button")).click();
        //Explicit Wait - To load new contact details filling page
        WebDriverWait wait = new WebDriverWait(driver, 2000);
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[1]/div[1]/div/div/input")));

        //Create an object of File class to open xlsx file
        File file = new File("C:\\Contacts.xlsx");

        //Create an object of FileInputStream class to read excel file
        FileInputStream inputStream = new FileInputStream(file);

        //create object of XSSFWorkbook class for xlsx file
        Workbook ContactsWorkbook = new XSSFWorkbook(inputStream);

        //Read sheet inside the workbook by its name
        Sheet FirstSheet = ContactsWorkbook.getSheet("Sheet1");

        //Find number of rows in excel file
        int rowCount = FirstSheet.getLastRowNum()-FirstSheet.getFirstRowNum();

        //Create a loop over all the rows of excel file to read it
        for (int i = 0; i < rowCount+1; i++) {
            Row row = FirstSheet.getRow(i);

            //Create a loop to print cell values in a row
            for (int j = 0; j < row.getLastCellNum(); j++) {

                //Print Excel data in console
                System.out.print(row.getCell(j).getStringCellValue()+"|| ");
                //Send firstname value
                if(j==0 && i!=0) {
                    String FirstName= row.getCell(j).getStringCellValue();
                    driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[1]/div[1]/div/div/input")).sendKeys(FirstName);
                }
                //Send lastname value
                if(j==1 && i!=0) {
                    String LastName= row.getCell(j).getStringCellValue();
                    driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[2]/div[1]/div/div/input")).sendKeys(LastName);
                }
                //Send Emailid value
                if(j==2 && i!=0) {
                    String EmailId= row.getCell(j).getStringCellValue();
                    driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[4]/div/div/div/div/div[1]/input")).sendKeys(EmailId);
                }

                }
            if(i!=0) {
                //Click Save button for contact record
                driver.findElement(By.xpath("//*[@id=\"dashboard-toolbar\"]/div[2]/div/button[2]")).click();
                Thread.sleep(1000);
                //Click On Contacts again to get contacts list
                driver.findElement(By.linkText("Contacts")).click();
                Thread.sleep(1000);
                //Click on New button
                driver.findElement(By.xpath("//*[@id=\"dashboard-toolbar\"]/div[2]/div/a/button")).click();
                //Explicit Wait - To load new contact details filling page
                WebDriverWait wait11 = new WebDriverWait(driver, 2000);
                wait11.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[1]/div[1]/div/div/input")));
            }
            System.out.println();
        }
        //Creating the JavascriptExecutor interface object by Type casting
        JavascriptExecutor js = (JavascriptExecutor)driver;
        //To generate Alert window using JavascriptExecutor. Display the alert message
        js.executeScript("alert('Added all contacts from xlsx sheet!');");
        Thread.sleep(1000);
        driver.switchTo().alert().accept();
        Thread.sleep(500);
        }

    @Test
    @Order(4)
    //Reading data from contact page and writing it to text file
    public void writeContacts() throws InterruptedException {
        //Click on Contacts section from Left hand pane
        Thread.sleep(500);
        driver.findElement(By.linkText("Contacts")).click();
        Thread.sleep(500);
        //Finding no of rows and columns
        int rowCount= driver.findElements(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/table/tbody/tr")).size();
        //int columnCount= driver.findElements(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/table/tbody/tr/td")).size();
        try {
            FileWriter writer = new FileWriter("C:\\SeleniumTxtFile\\CRMContacts.txt");
            writer.write("Name");
            writer.write("\r\t ||");   // Tab space
            writer.write("Address");
            writer.write("\r\t ||");   // Tab space
            writer.write("Phone");
            writer.write("\r\t ||");   // Tab space
            writer.write("Email");
            writer.write("\r\n");   // write new line
            //No of rows
            for(int i=1; i<= rowCount; i++) {
                // Cells
                for(int j=2; j<=5; j++) {
                    writer.write(driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/table/tbody/tr["+i+"]/td["+j+"]")).getText());
                    writer.write("\r\t ");   // Tab space
                }
                writer.write("\r\n");   // write new line
            }

            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        Thread.sleep(1000);
        //Creating the JavascriptExecutor interface object by Type casting
        JavascriptExecutor js = (JavascriptExecutor)driver;
        //To generate Alert window using JavascriptExecutor. Display the alert message
        js.executeScript("alert('Writing to text file complete!');");
        Thread.sleep(1000);
        driver.switchTo().alert().accept();
        Thread.sleep(500);
    }


    @Test
    @Order(5)
    public void addCalender() {
        //Adding Calendar Entry (Explicit Wait)
        driver.findElement(By.linkText("Calendar")).click();
        //Click on New Button
        driver.findElement(By.xpath("//*[@id=\"dashboard-toolbar\"]/div[2]/div/a/button")).click();
        //Wait for next window to load
        WebDriverWait wait1 = new WebDriverWait(driver,2000);
        WebElement ele2=wait1.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[1]/div[1]/div/div/input")));
        driver.findElement(By.xpath("//input[@name='title']")).sendKeys("Ms");

        //Selecting Category as Private
        driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[2]/div[1]/div/div")).click();
        driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[2]/div[1]/div/div/div[2]/div[8]/span")).click();

        //Sending static value for Start Date
        driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[2]/div[2]/div/div/div/input")).sendKeys("22/07/2019 14:00");
        driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[2]/div[2]/div")).click();

        //Click close icon of 'End Date' field to clear already existing value
        //driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[3]/div[1]/div/div/div/button")).click();

        //click inside Text field End Date to open Calender
        driver.findElement(By.xpath("//label[.='End Date']/following-sibling::div/child::div/child::input")).click();
        //Click next month button on calender
        driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[3]/div[1]/div/div[2]/div/button[2]")).click();
        //Select date and time
        driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[3]/div[1]/div/div[2]/div/div[2]/div[2]/div[4]/div[5]")).click();
        driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[3]/div[1]/div/div[2]/div/div[3]/div[2]/div/ul/li[95]")).click();

        //Clicking on 'All Day' toggle button
        driver.findElement(By.xpath("//label[.='All Day']/../div[contains(@class,'ui toggle')]")).click();

        //Adding Deal value
        driver.findElement(By.xpath("//label[text()='Deal']/following-sibling::div/child::input")).sendKeys("Testing");

        //if deal is new then add new word, if deal value already exists in dropdown then select that matching first value
        //works for both new and existing deal value
        driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[8]/div[2]/div/div/div[2]/div/span")).click();
        driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[10]/div[2]/div/div/input")).click();

    }


    @Test
    @Order(6)
    //Uploading document in Documents Tab (random number used for folder name)
    public void addDocument() throws InterruptedException, AWTException {
        //Adding new document - Custom Xpaths
        driver.findElement(By.xpath("//span[text()='Documents']")).click();
        Thread.sleep(2000);
        //Creating New Folder, clicking on New Folder Button
        driver.findElement(By.xpath("//a[@href='/documents/new']/preceding-sibling::button")).click();
        Thread.sleep(500);

        //Generating random number for folder name
        Random rg = new Random();
        int randomInt = rg.nextInt(1000);

        String folderName = "Test"+randomInt;

        //Sending name of the folder on pop up box
        driver.findElement(By.xpath("//input[@name='folderName']")).sendKeys(folderName);
        //Click Save button
        driver.findElement(By.xpath("//button[text()='Cancel']/following-sibling::button")).click();
        Thread.sleep(2000);
        //Click on newly created folder
        driver.findElement(By.xpath("//a[text()='"+folderName+"']")).click();
        //Click New button
        driver.findElement(By.xpath("//*[@id=\"dashboard-toolbar\"]/div[2]/div/a/button")).click();
        //Explicit wait for new page to load
        WebDriverWait wait1 = new WebDriverWait(driver,2000);
        WebElement ele2=wait1.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[1]/div[1]/div/div/input")));

        //Click Access button and make it private
        //driver.findElement(By.xpath("//label[.='Access']/following-sibling::div/child::div/child::button")).click();
        String access=driver.findElement(By.xpath("//label[.='Access']/following-sibling::div/child::div/child::button")).getText();
        if(access.equals("Public"))
        {
            driver.findElement(By.xpath("//label[.='Access']/following-sibling::div/child::div/child::button")).click();
        }
        //Click in textbox for selecting user for access
        driver.findElement(By.xpath("//div[contains(text(),'Select')]")).click();
        //Select user
        driver.findElement(By.xpath("//div[@role='option']/span[contains(text(),'<NAME>')]")).click();
        driver.findElement(By.xpath("//label[.='Description']/following-sibling::textarea")).click();

        Robot robot = new Robot();

        //Click inside file field
        driver.findElement(By.xpath("//label[.='File']/following-sibling::div/child::div/child::input")).click();

        robot.setAutoDelay(2000);

        StringSelection ss = new StringSelection("C:\\SeleniumScreenshots\\AddedContact.png");
        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);

        robot.setAutoDelay(2000);
        //native key strokes for CTRL +V and ENTER keys
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_V);

        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_V);
        robot.setAutoDelay(1000);

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

        //Click on Save
        driver.findElement(By.xpath("//*[@id=\"dashboard-toolbar\"]/div[2]/div/button[2]")).click();
        Thread.sleep(3500);
        String fileUploaded=driver.findElement(By.xpath("//a[@target='downloadFrame']")).getText();
        Assert.assertEquals("AddedContact.png",fileUploaded);

        Thread.sleep(1000);
        //Creating the JavascriptExecutor interface object by Type casting
        JavascriptExecutor js = (JavascriptExecutor)driver;
        //To generate Alert window using JavascriptExecutor. Display the alert message
        js.executeScript("alert('Document uploaded successfully');");
        Thread.sleep(1000);
        driver.switchTo().alert().accept();
        Thread.sleep(500);
   }


    @AfterAll
    public static void teardown(){
       driver.quit();
    }


}<file_sep>/src/test/java/HomePageTest.java
import org.junit.jupiter.api.*;
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.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.NoSuchElementException;

@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class HomePageTest {
    static WebDriver driver;

    @BeforeAll
    public static void setup() throws InterruptedException {
        System.setProperty("webdriver.chrome.driver", "C:\\BrowserDriver\\chromedriver.exe");
        driver = new ChromeDriver();
        driver.manage().window().maximize();
        driver.manage().deleteAllCookies();
        driver.get("https://freecrm.com/");
    }

    @Test
    @Order(1)
    public void CRM() throws InterruptedException{
        //Hover on CRM section of homepage using Actions class
        Thread.sleep(1000);
        WebElement CRM=driver.findElement(By.linkText("CRM"));
        Actions builder = new Actions(driver);
        //just focusing on CRM option
        builder.moveToElement(CRM).perform();
        Thread.sleep(1000);
        //Clicking on Call Center CRM option
        driver.findElement(By.xpath("//a[@href='callcenter.html']")).click();
        Thread.sleep(2000);
        //Scroll the page using JavaScript Executor
        JavascriptExecutor js = (JavascriptExecutor) driver;
        // This will scroll down the page by 1000 pixel vertical
        js.executeScript("window.scrollBy(0,1000)");
        Thread.sleep(2000);
        //Go to Homepage again
        driver.findElement(By.xpath("/html/body/div[1]/footer/div/div/div[1]/div/a/span[2]")).click();

        //Explicit wait until homepage loads
        WebDriverWait wait= new WebDriverWait(driver,2000);
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[@href='https://register.freecrm.com/register/']")));
        Thread.sleep(500);
    }

    @Test
    @Order(2)
    public void Compare() throws InterruptedException {
        //Click on Compare section
        driver.findElement(By.linkText("COMPARE")).click();
        Thread.sleep(500);
        String freeCRMPrice=driver.findElement(By.xpath("/html/body/div[1]/main/section[2]/div/div/div/div[2]/table/tbody/tr[2]/td[2]/a")).getText();
        if (freeCRMPrice.equals("Free")) {
            int freeCRMPrice1=0;
        }

        String freeSalesForcePrice=driver.findElement(By.xpath("//td[text()='Price']/following-sibling::td[2]")).getText();
        int endindex=freeSalesForcePrice.indexOf('-');
        String priceDiff=freeSalesForcePrice.substring(1,endindex);

        //Creating the JavascriptExecutor interface object by Type casting
        JavascriptExecutor js = (JavascriptExecutor)driver;
        //To generate Alert window using JavascriptExecutor. Display the alert message
        js.executeScript("alert('SalesForce min "+priceDiff+" dollar expensive than freeCRM')");
        Thread.sleep(1000);
        driver.switchTo().alert().accept();
        Thread.sleep(1000);
        /*
        //Go to Homepage again
        driver.findElement(By.xpath("/html/body/div[1]/footer/div/div/div[1]/div/a/span[2]")).click();

        //Explicit wait until homepage loads
        WebDriverWait wait= new WebDriverWait(driver,2000);
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[@href='https://register.freecrm.com/register/']")));
        Thread.sleep(1000); */
    }


    @Test
    @Order(3)
    //scrolling to section 'Increase sales by 30%' and navigating through its details
    public void IncreaseSales() throws InterruptedException {
     /*   Thread.sleep(1000);
        WebElement element = driver.findElement(By.xpath("/html/body/div[1]/main/section[5]/div/div[2]/div/div/div/div/ul/div[1]/div/div[1]/li/div[1]/div"));
        Actions actions = new Actions(driver);
        actions.moveToElement(element);
        actions.perform();
        Thread.sleep(4000); */
        driver.get("https://freecrm.com/");
        //Scroll the page using JavaScript Executor
        JavascriptExecutor js = (JavascriptExecutor) driver;
        // This  will scroll down the page by  1000 pixel vertical
        js.executeScript("window.scrollBy(0,2950)");
        Thread.sleep(2000);

        driver.findElement(By.xpath("//div[@class='owl-dot active']/following-sibling::div")).click();
        Thread.sleep(3000);

        driver.findElement(By.xpath("//div[@class='owl-dot active']/following-sibling::div")).click();
        Thread.sleep(3000);
    }

    @AfterAll
    public static void teardown(){
        driver.quit();
    }

    }

