All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gsd.sreenidhi.utils.DriverUtils Maven / Gradle / Ivy

Go to download

A Java framework that provides complete end-to-end automation functionality using Cucumber JVM to interface with Selenium, Appium and Java Core Technologies

There is a newer version: 1.2.16
Show newest version
package com.gsd.sreenidhi.utils;

import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import com.gsd.sreenidhi.cheetah.engine.CheetahEngine;

/**
 * @author Sreenidhi, Gundlupet
 *
 */
public class DriverUtils extends CheetahEngine {

	/**
	 * @param element
	 *            HTML Element
	 */
	public void highlightElement(WebElement element) {

		if(CheetahEngine.cheetahForm.isHighlights()) {
			if ("WEB".equalsIgnoreCase(CheetahEngine.props.getProperty("test.type"))) {
				CheetahEngine.original_style = element.getAttribute("style");
				WebDriver driver = CheetahEngine.getDriverInstance();
				JavascriptExecutor js = (JavascriptExecutor) driver;
				js.executeScript("arguments[0].setAttribute(arguments[1], arguments[2])", element, "style",
						"color: red; border: 3px solid red;");
			}

		}

	}

	/**
	 * @param element
	 *            HTMl Element
	 */
	public void unHighlightElement(WebElement element) {
		if(CheetahEngine.cheetahForm.isHighlights()) {
			if ("WEB".equalsIgnoreCase(CheetahEngine.props.getProperty("test.type"))) {
				WebDriver driver = CheetahEngine.getDriverInstance();
				JavascriptExecutor js = (JavascriptExecutor) driver;
				js.executeScript("arguments[0].setAttribute(arguments[1], arguments[2])", element, "style",
						CheetahEngine.original_style);
			}

		}

	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy