給大家分享一個高亮對象的方法,這個方法不止適用selenium,只要你是用java編寫代碼,其都可以
具體的js代碼
	package js;//該class在js包中
	import org.openqa.selenium.JavascriptExecutor;
	import org.openqa.selenium.WebDriver;
	import org.openqa.selenium.WebElement;
	// Highlight WebElement
	public class Highlight {
	public void highlightElement(WebDriver driver, WebElement element) {
	JavascriptExecutor js = (JavascriptExecutor) driver;
	js.executeScript("element = arguments[0];" +
	"original_style = element.getAttribute('style');" +
	"element.setAttribute('style', original_style + ";" +
	"background: yellow; border: 2px solid red;");" +
	"setTimeout(function(){element.setAttribute('style', original_style);}, 1000);", element);
	}
	}
在具體的class中調用該js
	import js.Highlight;//引入需要的js文件
	WebElement sche= driver.findElement(By.name("preschedule"));//對位對象
	Highlight hi=new Highlight();
	hi.highlightElement(driver,sche);//高亮所定位的對象
建議:希望大家把不同的東西放在不同包里面,這樣有利于后期的維護