Java, .NET, PHP, PYTHON, ANGULAR, ML, Data Science, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

Create Automation Script to implement getCssValue() and getAttribute() :- 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

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post