I am trying to get a place holder text with id as well as tried with xpath, it says unable to locate the element | Selenium Forum
S
Sand vazhapilly Posted on 22/02/2021

URL

 

1. I am trying to get the 'Place Holder' text of user name

 

Here is the code snippet:

String getText = driver.findElement(By.xpath("//input[@id='proxyUsername']")).getText();

    System.out.println(getText);

 

Fullcode:

    driver.get("https://www.cdkglobal.com/us")

     driver.findElement(By.xpath("//a[contains(text(),'Login')]")).click();;

     driver.findElement(By.xpath("//span[contains(text(),'CDK Global Product Login')]")).click();

      String actual = driver.getCurrentUrl();

      String exp = "https://www.cdkglobal.com/us/login";

      System.out.println(actual);

      Assert.assertEquals(actual, exp);

    String getText = driver.findElement(By.xpath("//input[@id='proxyUsername']")).getText();

    System.out.println(getText);

 

 

 

 


Related Posts