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

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

Automation Script to count total number paragraph and display Text:-

package basicexample;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class GetTextExample {

public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "c://chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.lipsum.com/");
List<WebElement> ele = driver.findElements(By.tagName("p"));
       System.out.println(ele.size());
for(WebElement obj:ele)
        {
        System.out.println(obj.getText());
        System.out.println("******************************************************************************");;
        }
       // System.out.print(s);
}

}


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