Create Automation Script to implement getCssValue(),getAttribute() and getLocation()

0


 package scs; 
import org.openqa.selenium.By; 
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.WebElement; 
import org.openqa.selenium.chrome.ChromeDriver; 
 public class GetCssValueExample
 {
 public static void main(String[] args) 
 System.setProperty("webdriver.chrome.driver", "c://chromedriver.exe"); 
 WebDriver driver = new ChromeDriver(); 
 driver.get("https://shivaconceptsolution.com/test.html"); 
 WebElement we = driver.findElement(By.id("txt1"));
 String s = we.getCssValue("width"); 
 System.out.print(s);
 String s1 = we.getAttribute("placeholder"); 
 System.out.print(s1); 
 String s2 = " x= "+we.getLocation().getX() + " y= "+ we.getLocation().getY(); 
 System.out.print(s2); 
 if(we.getLocation().getX()==50 && we.getLocation().getY()==50) 
 { 
 System.out.print("Valid"); 
 } 
 else {
 System.out.print("In Valid"); 
 } 
}
  

Post a Comment

0Comments

POST Answer of Questions and ASK to Doubt

Post a Comment (0)